Re: [HACKERS] pg_dump bug

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jose soares <jose(at)sferacarta(dot)com>
Cc: hackers <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] pg_dump bug
Date: 1999-11-19 15:07:44
Message-ID: 2349.943024064@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

jose soares <jose(at)sferacarta(dot)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 as
CREATE TABLE "ut" (
"d1" date DEFAULT '11-19-1999'::date);
Drat. I thought I'd taken care of that class of problems...

regards, tom lane

Browse pgsql-hackers by date

  From Date Subject
Next Message Gene Sokolov 1999-11-19 15:16:26 Curiously confused query parser.
Previous Message Jan Wieck 1999-11-19 14:48:35 Re: [HACKERS] psql & regress tests