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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
Cc: 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:03:24
Message-ID: 127.1226113404@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com> writes:
> Tom Lane wrote:
>> I've started reviewing this patch for commit, and I find myself a bit
>> disturbed by its compatibility properties. The SQL_STANDARD output
>> style is simply ambiguous: what is meant by
>> -1 1:00:00
>> ? What you get from that will depend on the intervalstyle setting at
>> the recipient.

> Nope. The SQL Standard style avoids the ambiguity by following
> the SQL Standard's rules when the input value complied with the
> standard's restrictions on intervals.

You're missing the point: the same string can mean different things
to different recipients depending on their intervalstyle setting.
This means it's unsafe to use that representation in pg_dump output,
unless we take steps to force the interpretation.

> Are you concerned about someone dumping in SQL_STANDARD mode and
> then importing in POSTGRES mode?

Exactly.

> If so, how's the similar case handled with date order?

ISO date format is read the same regardless of recipient's datestyle,
so pg_dump solves this by forcing the dump to be made in ISO style.
The corresponding solution for intervals will be to dump in POSTGRES
style, not SQL_STANDARD style, which seems a bit unfortunate.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-11-08 03:08:24 Re: Patch for SQL-Standard Interval output and decoupling DateStyle from IntervalStyle
Previous Message Ron Mayer 2008-11-08 02:56:48 Re: Patch for SQL-Standard Interval output and decoupling DateStyle from IntervalStyle