in reply to Unique ID

If this unique ID does not have to be any thing in particular, you might as well use the oid column. oid is unique for every single row in the database, and is created when you insert a row.

It's sort of a "hidden" field, so when you query, you have to do

SELECT oid,* FROM table; # if you already know your oid.. SELECT * FROM table WHERE oid = x;

This is so much easier than maintaining a sequence.... and is universal for Postgres.

Replies are listed 'Best First'.
Re: Re: Unique ID
by nlafferty (Scribe) on Jul 19, 2001 at 23:36 UTC
    So how would i do a delete statement WHERE oid = "$oid" ?

      That is correct, sir

      Well, since you are using "$oid", I should make sure and point out that you really should use place holders...

      $dbh->do( "DELETE FROM table WHERE oid = ?", undef, $oid ); or $sth = $dbh->prepare( "DELETe FROM table WHERE oid = ?" ); $sth->execute( $oid );
Re: Re: Unique ID
by nlafferty (Scribe) on Jul 19, 2001 at 21:14 UTC
    This is originally how i thought would be a good way to handle this. I'll give it a shot...thank you ;)