pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedNegative numbers for PK/ID's?
2+ messages / 2 participants
[nested] [flat]
* Negative numbers for PK/ID's?
@ 2008-02-05 19:42 Steve Midgley <public@misuse.org>
2008-02-05 21:23 ` Re: Negative numbers for PK/ID's? Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: Steve Midgley @ 2008-02-05 19:42 UTC (permalink / raw)
To: 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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Negative numbers for PK/ID's?
2008-02-05 19:42 Negative numbers for PK/ID's? Steve Midgley <public@misuse.org>
@ 2008-02-05 21:23 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2008-02-05 21:23 UTC (permalink / raw)
To: Steve Midgley <public@misuse.org>; +Cc: pgsql-sql
Steve Midgley <public@misuse.org> writes:
> I'm wondering if there are any Bad Things that happen if I use negative
> integers for primary key values in Postgres (v8.2)?
No.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2008-02-05 21:23 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-02-05 19:42 Negative numbers for PK/ID's? Steve Midgley <public@misuse.org>
2008-02-05 21:23 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox