Re: [SQL] Defaulting a column to 'now'

2005-12-15 Thread Ken Winter
Thanks, Tom (also Keith Worthington and Bricklen Anderson). That works. ~ Ken -Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 14, 2005 1:15 PM To: Ken Winter Cc: PostgreSQL pg-sql list Subject: Re: [SQL] Defaulting a column to 'now' Ken

[SQL] Defaulting a column to 'now'

2005-12-14 Thread Ken Winter
How can a columns default be set to now, meaning now as of when each row is inserted? For example, heres a snip of DDL: create table personal_data ( effective_date_and_time TIMESTAMP WITH TIME ZONE not null default 'now', The problem is, when PostgreSQL processes this DDL, it

Re: [SQL] Defaulting a column to 'now'

2005-12-14 Thread Tom Lane
Ken Winter [EMAIL PROTECTED] writes: How can a column's default be set to 'now', meaning 'now' as of when each row is inserted? You need a function, not a literal constant. The SQL-spec way is CURRENT_TIMESTAMP (which is a function, despite the spec's weird idea that it should be

Re: [SQL] Defaulting a column to 'now'

2005-12-14 Thread Bricklen Anderson
Ken Winter wrote: How can a column’s default be set to ‘now’, meaning ‘now’ as of when each row is inserted? For example, here’s a snip of DDL: create table personal_data (… effective_date_and_time TIMESTAMP WITH TIME ZONE not null default 'now',… try with now(), instead of now

Re: [SQL] Defaulting a column to 'now'

2005-12-14 Thread Keith Worthington
On Wed, 14 Dec 2005 13:10:50 -0500, Ken Winter wrote How can a column's default be set to 'now', meaning 'now' as of when each row is inserted? For example, here's a snip of DDL: create table personal_data (. effective_date_and_time TIMESTAMP WITH TIME ZONE not null default 'now',.