| From: | Steve Midgley <public(at)misuse(dot)org> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Negative numbers for PK/ID's? |
| Date: | 2008-02-05 19:42:20 |
| Message-ID: | 20080205194233.CACE62E4479@postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
Hi,
A while ago on a different SQL platform, I had the idea to use negative
numbers as id's for certain system records that I didn't prefer to have
interspersed with other records in a table. (For example, we had
"template" records which we used to spawn new records, and rather than
store them in a different table we just had records id=-1,-2 etc and
did an insert/select to create new "live" rows based on the templates).
Preventing them from displaying in the results was as simple as
ensuring that all select statements had a "id > 0" statement in them..
I'm wondering if there are any Bad Things that happen if I use negative
integers for primary key values in Postgres (v8.2)? My primary keys are
all bigserial type.
Any comments or advice?
Thanks!
Steve
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jaime Casanova | 2008-02-05 19:46:30 | Re: Cast in PG 8.3 |
| Previous Message | Li, Jingfa | 2008-02-05 19:39:26 | Re: Cast in PG 8.3 |