Skip site navigation (1) Skip section navigation (2)

Re: Patch for column properties

From: "Florian G(dot) Pflug" <fgp(at)phlo(dot)org>
To: Dave Page <dpage(at)postgresql(dot)org>
Cc: Guillaume Lelarge <guillaume(at)lelarge(dot)info>, pgadmin-hackers(at)postgresql(dot)org
Subject: Re: Patch for column properties
Date: 2007-03-02 14:52:27
Message-ID: 45E83A2B.2000905@phlo.org (view raw or flat)
Thread:
Lists: pgadmin-hackers
Dave Page wrote:
> Guillaume Lelarge wrote:
>> Hi,
>>
>> When someone set a default value for a column and set NOT NULL at the 
>> same time, the query could fail if the table already contains NULL 
>> values for this column. This patch adds an UPDATE statement to put the 
>> DEFAULT value in this column for all NULL values (but only when you 
>> SET NULL and SET DEFAULT the column at the same time).
>>
>> I've done this patch for a friend but I don't quite like this patch 
>> because of its behaviour. It doesn't warn the user. I think it would 
>> be better to show a dialog telling that an UPDATE statement will be 
>> executed because otherwise the whole action could fail.
>>
>> So here are some questions :
>>  * do you think this patch is worth it ?
> 
> I'm not keen on the idea.I prefer to leave that sort of behaviour to the 
> server, *if* thats the way it gets written.

You could first execute "alter table .. set default ...; alter table ..set not 
null" first, and only if the "set not null" fails ask the user if he wants
the update to be performed. I personally would like the feature I think,
though I can easily live without it ;-)

greetings, Florian Pflug

In response to

Responses

pgadmin-hackers by date

Next:From: svnDate: 2007-03-02 16:38:06
Subject: SVN Commit by dpage: r5965 - in trunk/pgadmin3: . pgadmin pgadmin/dlg pgadmin/include/dlg pgadmin/include/schema pgadmin/schema pgadmin/ui
Previous:From: Dave PageDate: 2007-03-02 11:00:34
Subject: Re: Patch for pgstatindex

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group