Re: Patch for column properties

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: "Florian G(dot) Pflug" <fgp(at)phlo(dot)org>
Cc: Dave Page <dpage(at)postgresql(dot)org>, pgadmin-hackers(at)postgresql(dot)org
Subject: Re: Patch for column properties
Date: 2007-03-04 10:32:37
Message-ID: 45EAA045.6020609@lelarge.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Florian G. Pflug a écrit :
> 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 ;-)
>

Perhaps we can do this with a better error message.

There's something I really like with EMS SQL Manager. When the user
change a property, the SQL is shown and can be changed. If the COMMIT
failed, they show you the SQL and it also can be modified. Perhaps we
just need this ? When there is a PostgreSQL related error message,
pgAdmin shows the SQL it tried to execute and let the user change it. I
think it would be a better behavior than what my patch implied. Would
something like this be possible ? And one more question, I wonder why
the SQL tab is not editable ? I can think of one reason but I'm not sure :)

Regards.

--
Guillaume.
<!-- http://abs.traduc.org/
http://lfs.traduc.org/
http://docs.postgresqlfr.org/ -->

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dave Page 2007-03-04 10:44:48 Re: Patch for column properties
Previous Message Guillaume Lelarge 2007-03-04 10:24:49 Re: Patch for column properties