Bug: timestamp without time zone column allows timestamptz default

From: David Fetter <david(at)fetter(dot)org>
To: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Bug: timestamp without time zone column allows timestamptz default
Date: 2017-03-14 15:09:05
Message-ID: 20170314150905.GA21130@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Folks,

What happens now:

CREATE TABLE bar(id int DEFAULT 'a');
ERROR: invalid input syntax for integer: "a"

Good so far. Now with a different data type.

CREATE TABLE bar(t TIMESTAMP WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP);
CREATE TABLE

This is a foot gun we need not have. TIMESTAMP WITHOUT TIME ZONE is
already a foot gun for the vast majority of real world cases. We
should not be making it worse by papering this over.

Ideally, this would look more like:

CREATE TABLE bar(t TIMESTAMP WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP);
ERROR: invalid input syntax for timestamp without time zone: current_timestamp
HINT: perhaps you meant to use timestamp with time zone.

Best,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-03-14 15:22:01 Re: Bug: timestamp without time zone column allows timestamptz default
Previous Message David Steele 2017-03-14 15:01:45 Re: PATCH: Configurable file mode mask