pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable
7+ messages / 6 participants
[nested] [flat]
* BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable
@ 2017-10-03 19:52 edpeur@gmail.com
2017-10-03 20:20 ` Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: edpeur@gmail.com @ 2017-10-03 19:52 UTC (permalink / raw)
To: pgsql-bugs; +Cc: edpeur@gmail.com
The following bug has been logged on the website:
Bug reference: 14842
Logged by: Eduardo Perez
Email address: edpeur@gmail.com
PostgreSQL version: Unsupported/Unknown
Operating system: All
Description:
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
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable
2017-10-03 19:52 BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable edpeur@gmail.com
@ 2017-10-03 20:20 ` David G. Johnston <david.g.johnston@gmail.com>
2017-10-03 20:38 ` Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 7+ messages in thread
From: David G. Johnston @ 2017-10-03 20:20 UTC (permalink / raw)
To: edpeur@gmail.com; +Cc: pgsql-bugs
On Tue, Oct 3, 2017 at 12:52 PM, <edpeur@gmail.com> wrote:
> The following bug has been logged on the website:
>
> Bug reference: 14842
> Logged by: Eduardo Perez
> Email address: edpeur@gmail.com
> PostgreSQL version: Unsupported/Unknown
> Operating system: All
> Description:
>
> 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.
I was curious whether something like "ALTER CAST ... NO IMPLICIT" would
work but alas no such feature presently exists.
David J.
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable
2017-10-03 19:52 BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable edpeur@gmail.com
2017-10-03 20:20 ` Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable David G. Johnston <david.g.johnston@gmail.com>
@ 2017-10-03 20:38 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-10-03 21:19 ` Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable Eduardo Pérez Ureta <edpeur@gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: Tom Lane @ 2017-10-03 20:38 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: pgsql-bugs
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Tue, Oct 3, 2017 at 12:52 PM, <edpeur@gmail.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
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable
2017-10-03 19:52 BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable edpeur@gmail.com
2017-10-03 20:20 ` Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable David G. Johnston <david.g.johnston@gmail.com>
2017-10-03 20:38 ` Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-10-03 21:19 ` Eduardo Pérez Ureta <edpeur@gmail.com>
2017-10-03 21:54 ` Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable David G. Johnston <david.g.johnston@gmail.com>
2017-10-04 11:06 ` Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable Francisco Olarte <folarte@peoplecall.com>
0 siblings, 2 replies; 7+ messages in thread
From: Eduardo Pérez Ureta @ 2017-10-03 21:19 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; 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@sss.pgh.pa.us>:
> "David G. Johnston" <david.g.johnston@gmail.com> writes:
> > On Tue, Oct 3, 2017 at 12:52 PM, <edpeur@gmail.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
>
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable
2017-10-03 19:52 BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable edpeur@gmail.com
2017-10-03 20:20 ` Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable David G. Johnston <david.g.johnston@gmail.com>
2017-10-03 20:38 ` Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable Tom Lane <tgl@sss.pgh.pa.us>
2017-10-03 21:19 ` Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable Eduardo Pérez Ureta <edpeur@gmail.com>
@ 2017-10-03 21:54 ` David G. Johnston <david.g.johnston@gmail.com>
2017-10-03 22:00 ` Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable John R Pierce <pierce@hogranch.com>
1 sibling, 1 reply; 7+ messages in thread
From: David G. Johnston @ 2017-10-03 21:54 UTC (permalink / raw)
To: Eduardo Pérez Ureta <edpeur@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-bugs
On Tue, Oct 3, 2017 at 2:19 PM, Eduardo Pérez Ureta <edpeur@gmail.com>
wrote:
> 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.
>
It has its quirks but the two you have fixated on seem easy enough to
avoid.
At this point we've already decided that being conforming is generally a
virtue; especially since I'd assume that at least some "other SQL
databases" also conform to these same rules. Deciding to become more
strict (as opposed to starting out that way) requires significant benefit.
David J.
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable
2017-10-03 19:52 BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable edpeur@gmail.com
2017-10-03 20:20 ` Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable David G. Johnston <david.g.johnston@gmail.com>
2017-10-03 20:38 ` Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable Tom Lane <tgl@sss.pgh.pa.us>
2017-10-03 21:19 ` Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable Eduardo Pérez Ureta <edpeur@gmail.com>
2017-10-03 21:54 ` Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable David G. Johnston <david.g.johnston@gmail.com>
@ 2017-10-03 22:00 ` John R Pierce <pierce@hogranch.com>
0 siblings, 0 replies; 7+ messages in thread
From: John R Pierce @ 2017-10-03 22:00 UTC (permalink / raw)
To: pgsql-bugs
On 10/3/2017 2:54 PM, David G. Johnston wrote:
> On Tue, Oct 3, 2017 at 2:19 PM, Eduardo Pérez Ureta <edpeur@gmail.com
> <mailto:edpeur@gmail.com>>wrote:
>
> 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.
>
>
> It has its quirks but the two you have fixated on seem easy enough to
> avoid.
>
> At this point we've already decided that being conforming is generally
> a virtue; especially since I'd assume that at least some "other SQL
> databases" also conform to these same rules. Deciding to become more
> strict (as opposed to starting out that way) requires significant benefit.
>
>
IMHO, at *most* postgres could issue warnings on usage of sketchy
constructs. I think emphasizing the warning in the documentation is
sufficient, however.
--
john r pierce, recycling bits in santa cruz
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable
2017-10-03 19:52 BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable edpeur@gmail.com
2017-10-03 20:20 ` Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable David G. Johnston <david.g.johnston@gmail.com>
2017-10-03 20:38 ` Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable Tom Lane <tgl@sss.pgh.pa.us>
2017-10-03 21:19 ` Re: BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable Eduardo Pérez Ureta <edpeur@gmail.com>
@ 2017-10-04 11:06 ` Francisco Olarte <folarte@peoplecall.com>
1 sibling, 0 replies; 7+ messages in thread
From: Francisco Olarte @ 2017-10-04 11:06 UTC (permalink / raw)
To: Eduardo Pérez Ureta <edpeur@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; David G. Johnston <david.g.johnston@gmail.com>; pgsql-bugs
Eduardo:
On Tue, Oct 3, 2017 at 11:19 PM, Eduardo Pérez Ureta <edpeur@gmail.com> wrote:
> 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.
Are you sure they ( other DB ) do it this way? I've not used too many
other databases recently, but what I remember is they deviated from
the standard not because it was broken, but because it was easier to
deviate than not.
Francisco Olarte.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2017-10-04 11:06 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-10-03 19:52 BUG #14842: TIMESTAMP WITH TIME ZONE and TIMESTAMP WITHOUT TIMEZONE should not be comparable edpeur@gmail.com
2017-10-03 20:20 ` David G. Johnston <david.g.johnston@gmail.com>
2017-10-03 20:38 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-10-03 21:19 ` Eduardo Pérez Ureta <edpeur@gmail.com>
2017-10-03 21:54 ` David G. Johnston <david.g.johnston@gmail.com>
2017-10-03 22:00 ` John R Pierce <pierce@hogranch.com>
2017-10-04 11:06 ` Francisco Olarte <folarte@peoplecall.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox