pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
filling an empty table w/ defaults defined
2+ messages / 2 participants
[nested] [flat]

* filling an empty table w/ defaults defined
@ 1999-04-27 19:57 JT Kirkpatrick <jt-kirkpatrick@mpsllc.com>
  0 siblings, 0 replies; 2+ messages in thread

From: JT Kirkpatrick @ 1999-04-27 19:57 UTC (permalink / raw)
  To: 'pgsql-sql@hub.org' <pgsql-sql@hub.org>

Is there a way to "turn off" a field (insertdt datetime primary key default 
text 'now') as I populate a table?  I have a populated table, and a mirror 
image of its structure except with the field shown above added.  I'd like 
to insert data into the new table from the old, but postgres is telling me 
it cannot insert a duplicate key into a unique index - I figure it is 
trying to use the same date/time value for 'now'.  is there any other way?

jt




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* RE: [SQL] filling an empty table w/ defaults defined
@ 1999-04-27 20:37 Jackson, DeJuan <djackson@cpsgroup.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Jackson, DeJuan @ 1999-04-27 20:37 UTC (permalink / raw)
  To: JT Kirkpatrick <jt-kirkpatrick@mpsllc.com>; 'pgsql-sql@hub.org' <pgsql-sql@hub.org>

The problem is that the datetime entry is generating the same time values in
the transaction.  You do not want that as your primary key.  You can still
create an index on the value, but if two (or more) rows are ever inserted in
the same transaction or even at the exact same time your primary key will be
invalid.
If you can't recreate the table with another primary key the just drop the
index.  You can create a new index with the CREATE INDEX statement.

> Is there a way to "turn off" a field (insertdt datetime primary key
> default 
> text 'now') as I populate a table?  I have a populated table, and a mirror
> 
> image of its structure except with the field shown above added.  I'd like 
> to insert data into the new table from the old, but postgres is telling me
> 
> it cannot insert a duplicate key into a unique index - I figure it is 
> trying to use the same date/time value for 'now'.  is there any other way?
> 
> jt
> 



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1999-04-27 20:37 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-04-27 19:57 filling an empty table w/ defaults defined JT Kirkpatrick <jt-kirkpatrick@mpsllc.com>
1999-04-27 20:37 RE: [SQL] filling an empty table w/ defaults defined Jackson, DeJuan <djackson@cpsgroup.com>

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