Re: [PATCH] Fix column SQL

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Timon <timosha(at)gmail(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Fix column SQL
Date: 2012-08-23 08:18:16
Message-ID: CA+OCxoyYTPt07LcJ-7cQ0ndRiP3ybVYLh6iXqpfSd69rX+upaA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers pgadmin-support

On Thu, Aug 23, 2012 at 7:19 AM, Timon <timosha(at)gmail(dot)com> wrote:
> attached patch fixes SQL of column in SQL pane.
> sql should be like
> ALTER TABLE table ADD COLUMN tms timestamp without time zone NOT NULL
> DEFAULT now();
> and not
> ALTER TABLE table ADD COLUMN tms timestamp without time zone;
> ALTER TABLE table ALTER COLUMN tms SET NOT NULL;
> ALTER TABLE table ALTER COLUMN tms SET DEFAULT now();
>
> it avoids not null constraint problem when you add column to existing
> table with some data

I can't find the references in the archives (I'm sure this has come up
before), but iirc, we intentionally didn't do this as it wouldn't be
clear to the user that despite they might be about to cause a huge
write. I'm sure there was more to it than that, but my Google-fu is
failing me at the moment.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Timon 2012-08-23 08:33:04 Re: [pgadmin-hackers] [PATCH] Fix column SQL
Previous Message Timon 2012-08-23 06:19:13 [PATCH] Fix column SQL

Browse pgadmin-support by date

  From Date Subject
Next Message Timon 2012-08-23 08:33:04 Re: [pgadmin-hackers] [PATCH] Fix column SQL
Previous Message Timon 2012-08-23 06:19:13 [PATCH] Fix column SQL