Re: [HACKERS] pg_dump bug - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] pg_dump bug
Date
Msg-id 2349.943024064@sss.pgh.pa.us
Whole thread Raw
In response to pg_dump bug  (jose soares <jose@sferacarta.com>)
Responses Re: [HACKERS] pg_dump bug
List pgsql-hackers
jose soares <jose@sferacarta.com> writes:
> I think I found a bug in pg_dump:

It's not pg_dump's fault; it's just putting out what's in the system
tables, and "date( 'current'::datetime + '0 sec')" is how the 6.5.*
parser translates DEFAULT CURRENT_DATE.  (Which is inconsistent with
how it translates CURRENT_DATE in other contexts, but nevermind.)

The failure actually comes up because the 6.5.* parser can't cope with
"x::y"-style typecasts in default expressions; it translates them to
a syntactically invalid string.  CAST ... AS doesn't work either, BTW.

I have ripped out and rewritten all of that cruft for 7.0, which is why
it works now (more or less).  I dunno if it's worth trying to patch
around this particular bug in the default-handling code in 6.5.*.
It's got so many others :-(

Current sources still have a problem with this example, which is that
the default expression gets prematurely constant-folded:CREATE TABLE ut (d1 DATE DEFAULT CURRENT_DATE);
pg_dumps asCREATE TABLE "ut" (        "d1" date DEFAULT '11-19-1999'::date);
Drat.  I thought I'd taken care of that class of problems...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Oleg Bartunov
Date:
Subject: Re: [BUGS] Problems in 6.5.3 with Multi-Byte encoding
Next
From: "Gene Sokolov"
Date:
Subject: Curiously confused query parser.