pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Steve Midgley <public@misuse.org>
To: pgsql-sql@postgresql.org
Subject: Negative numbers for PK/ID's?
Date: Tue, 05 Feb 2008 11:42:20 -0800
Message-ID: <20080205194233.CACE62E4479@postgresql.org> (raw)

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




view thread (2+ messages)  latest in thread

Message-ID: <20080205194233.CACE62E4479@postgresql.org>
Permalink:  ../20080205194233.CACE62E4479@postgresql.org/
Also on:    postgresql.org/message-id/20080205194233.CACE62E4479@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: public@misuse.org
  Subject: Re: Negative numbers for PK/ID's?
  In-Reply-To: <20080205194233.CACE62E4479@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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