pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
dump and schema
5+ messages / 4 participants
[nested] [flat]

* dump and schema
@ 2003-12-15 15:33  van Elsacker Frans <fve@atbib.be>
  0 siblings, 1 reply; 5+ messages in thread

From: van Elsacker Frans @ 2003-12-15 15:33 UTC (permalink / raw)
  To: pgsql-sql

I have a problem with date default and schema's and don't know wether I am 
doing something wrong or not.

All my tables (more than 100) have a field datumi of type date default 
today, as this example:
CREATE TABLE tabel (
     ....
     datumi date DEFAULT 'today',
     ....
);
taking a dump or a schema of this table via pg_dump and restoring or using 
it went fine

Now I am using postgres 7.4 and  making a schema (and also the table in a 
dump gave this result)
CREATE TABLE  tabel(
     ....
     datumi date DEFAULT '2003-12-10'::date,
     ....
);

which is not expected for a schema. Even worse by restoring a dump, all my 
new records have this fixed date in the field datumi.
Something has changed? I do it in the wrong way?  Is there a solution ?

many thanks




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

* Re: dump and schema
@ 2003-12-15 16:22  Tom Lane <tgl@sss.pgh.pa.us>
  parent: van Elsacker Frans <fve@atbib.be>
  0 siblings, 1 reply; 5+ messages in thread

From: Tom Lane @ 2003-12-15 16:22 UTC (permalink / raw)
  To: van Elsacker Frans <fve@atbib.be>; +Cc: pgsql-sql

van Elsacker Frans <fve@atbib.be> writes:
> All my tables (more than 100) have a field datumi of type date default 
> today, as this example:
> CREATE TABLE tabel (
>      ....
>      datumi date DEFAULT 'today',
>      ....
> );

This does not work anymore in PG 7.4.  You need something like

	datumi date DEFAULT CURRENT_DATE,

			regards, tom lane



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

* Re: dump and schema
@ 2003-12-16 09:27  Olivier Hubaut <olivier@scmbb.ulb.ac.be>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 5+ messages in thread

From: Olivier Hubaut @ 2003-12-16 09:27 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: van Elsacker Frans <fve@atbib.be>; pgsql-sql

Tom Lane wrote:

> van Elsacker Frans <fve@atbib.be> writes:
> 
>>All my tables (more than 100) have a field datumi of type date default 
>>today, as this example:
>>CREATE TABLE tabel (
>>     ....
>>     datumi date DEFAULT 'today',
>>     ....
>>);
> 
> 
> This does not work anymore in PG 7.4.  You need something like
> 
> 	datumi date DEFAULT CURRENT_DATE,
> 
> 			regards, tom lane
> 
I think this won't get the same result he expects. As I know, the 
CURRENT_DATE will always give the current day, not the day you inserted 
the row.

I think the now()::date seems to be a better way to translate the 
'today' value.

-- 
Ci-git une signature avortee.
** RIP **



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

* Re: dump and schema
@ 2003-12-16 13:28  Peter Eisentraut <peter_e@gmx.net>
  parent: Olivier Hubaut <olivier@scmbb.ulb.ac.be>
  1 sibling, 0 replies; 5+ messages in thread

From: Peter Eisentraut @ 2003-12-16 13:28 UTC (permalink / raw)
  To: Olivier Hubaut <olivier@scmbb.ulb.ac.be>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: van Elsacker Frans <fve@atbib.be>; pgsql-sql

Olivier Hubaut wrote:
> I think this won't get the same result he expects. As I know, the
> CURRENT_DATE will always give the current day, not the day you
> inserted the row.

Your knowledge is incorrect.




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

* Re: dump and schema
@ 2003-12-16 14:17  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Olivier Hubaut <olivier@scmbb.ulb.ac.be>
  1 sibling, 0 replies; 5+ messages in thread

From: Tom Lane @ 2003-12-16 14:17 UTC (permalink / raw)
  To: Olivier Hubaut <olivier@scmbb.ulb.ac.be>; +Cc: van Elsacker Frans <fve@atbib.be>; pgsql-sql

Olivier Hubaut <olivier@scmbb.ulb.ac.be> writes:
> Tom Lane wrote:
>> This does not work anymore in PG 7.4.  You need something like
>> datumi date DEFAULT CURRENT_DATE,

> I think the now()::date seems to be a better way to translate the 
> 'today' value.

There is no real difference.

			regards, tom lane



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


end of thread, other threads:[~2003-12-16 14:17 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-12-15 15:33 dump and schema van Elsacker Frans <fve@atbib.be>
2003-12-15 16:22 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-12-16 09:27   ` Olivier Hubaut <olivier@scmbb.ulb.ac.be>
2003-12-16 13:28     ` Peter Eisentraut <peter_e@gmx.net>
2003-12-16 14:17     ` 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