Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable

From: Eduardo Pérez Ureta <edpeur(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable
Date: 2017-10-03 21:19:46
Message-ID: CAM7oS3G9nfh3KeD5R=hMHHfSAnfZEUBFSPfzOnMPvRDKSFSs0A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I did not know that the SQL standard was so broken. Maybe it is time to
consider only following the SQL standard in its non-broken parts, like
other SQL databases do.

2017-10-03 20:38 GMT+00:00 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:

> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > On Tue, Oct 3, 2017 at 12:52 PM, <edpeur(at)gmail(dot)com> wrote:
> >> Currently you can do:
> >> CREATE TABLE t1 (ts TIMESTAMP WITH TIME ZONE NOT NULL,tr TIMESTAMP
> WITHOUT
> >> TIME ZONE NOT NULL);
> >> INSERT INTO t1 (ts,tr) VALUES (CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
> >> SELECT * FROM t1 WHERE ts=tr;
> >>
> >> But it should fail with:
> >> ERROR: operator does not exist: timestamp with time zone = timestamp
> >> without time zone
> >> Also CURRENT_TIMESTAMP should fail to be inserted into a TIMESTAMP
> WITHOUT
> >> TIME ZONE column
> >> ERROR: column "tr" is of type timestamp without time zone but
> expression
> >> is of type timestamp with time zone
>
> > ​This is working as intended and given the amount of pain removing
> implicit
> > casts​ generally involves it is unlikely to change.
>
> Not to mention that the SQL standard requires these implicit casts to
> exist.
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2017-10-03 21:42:57 Re: BUG #14841: Remove TIME WITH TIME ZONE type
Previous Message Eduardo Pérez Ureta 2017-10-03 21:19:17 Re: BUG #14841: Remove TIME WITH TIME ZONE type