Re: Patch for SQL-Standard Interval output and decoupling DateStyle from IntervalStyle

From: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>, Brendan Jurd <direvus(at)gmail(dot)com>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch for SQL-Standard Interval output and decoupling DateStyle from IntervalStyle
Date: 2008-11-08 03:29:35
Message-ID: 4915079F.8070006@cheapcomplexdevices.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com> writes:
>> Rather than forcing Postgres mode; couldn't it put a
>> "set intervalstyle = [whatever the current interval style is]"
>> in the dump file?
>
> This would work for loading into a PG >= 8.4 server, and fail miserably
> for loading into pre-8.4 servers. Even though we don't guarantee
> backwards compatibility of dump files, I'm loath to adopt a solution
> that will successfully load wrong data into an older server.

'k.
So the options seem to be:

(1) Don't output a SQL-standard interval literal for the
value "negative one days and negative one hours"; perhaps
by sticking an extra '+' sign in there?

(2) Force pg_dump to a non-standard mode, at least until 8.3's
deprecated in many years?
After that, pg_dump can use any intervalstyle so long as
it says which one it uses.

(3) Put something into the dump file that will make the old
server reject the file rather than successfully loading
wrong data? (Some "if intervalstyle==std and version<8.3
abort loading the restore" logic?)

I don't much like the first one, because it seems we're oh-so-close
to meeting the standard.

I don't know how to do the third one; but if pg_dump had
an "assert(version>=8.4)" feature it might be useful if
we ever had other non-backward-compatible changes. pg_dump
would only put that assert-like-thing in the dump file if
the sql_standard mode (or iso mode, if that gets approved)
was chosen.

The second one doesn't really seem that scary to me; since
the uglyness can go away when we eventually stop restoring
into 83.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message KaiGai Kohei 2008-11-08 05:21:59 Re: Updates of SE-PostgreSQL 8.4devel patches (r1197)
Previous Message Ron Mayer 2008-11-08 03:11:25 Re: Patch for SQL-Standard Interval output and decoupling DateStyle from IntervalStyle