pg_dump or psql bug

From: lfrigault(at)aim(dot)fr (Laurent Frigault)
To: pgsql-bugs(at)postgresql(dot)org
Subject: pg_dump or psql bug
Date: 2000-02-15 16:29:43
Message-ID: 88butn$t5q$1@gromit.adrenaline.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

I've found a bug either in pg_dump or in psql(Postgresql 6.5.3). When
using CURRENT_DATE as a default value, pg_dump produce an invalid dump
which can't be restored with psql. This can be reproduced this way:

% createdb foo
% psql foo
Welcome to the POSTGRESQL interactive sql monitor:
Please read the file COPYRIGHT for copyright terms of POSTGRESQL
[PostgreSQL 6.5.3 on i686-pc-linux-gnu, compiled by gcc 2.7.2.3]

type \? for help on slash commands
type \q to quit
type \g or terminate with semicolon to execute query
You are currently connected to the database: foo

foo=> CREATE TABLE bar( creation date DEFAULT CURRENT_DATE NOT NULL);
CREATE
foo=> \q
% pg_dump foo >foo.dump
% destroydb foo
% createdb foo
% psql foo < foo.dump
\connect - lolo
connecting as new user: lolo
CREATE TABLE "bar" (
"creation" date DEFAULT date( 'current'::datetime + '0 sec') NOT
NULL);
ERROR: parser: parse error at or near "'"
COPY "bar" FROM stdin;
ERROR: COPY command failed. Class bar does not exist.
... and a lot of garbage :-(

Of course, I can edit the dump to change
"creation" date DEFAULT date( 'current'::datetime + '0 sec') NOT NULL
to
"creation" date DEFAULT CURRENT_DATE NOT NULL

and then the database can be restored, but it is not a good solution
IMHO.

Configuration:
RedHat Linux 5.2 on Intel PII
Postgresql 6.5.3 build from original sources (not RPM)

Lolo
--
Laurent Frigault
Adrén(at)line Ingénierie Multimédia, 44, rue Blanche 75009 Paris
Tél : +33 1 55 31 78 00 Fax : +33 1 55 31 78 08 http://www.aim.fr
Visitez notre dernière réalisation : http://www.lapostefinance.fr

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Stamfest 2000-02-15 19:03:16 bug report
Previous Message Bruce Momjian 2000-02-13 13:20:33 Re: [HACKERS] Problems compiling latest CVS sources.