Re: [BUGS] [GENERAL] Altering a table with a rowtype column

2012-03-21 Thread Robert Haas
On Tue, Mar 20, 2012 at 2:48 PM, Tom Lane wrote: >> I think Tom's correct about what the right behavior would be if >> composite types supported defaults, but they don't, never have, and >> maybe never will.  I had a previous argument about this with Tom, and >> lost, though I am not sure that any

Re: [BUGS] [GENERAL] Altering a table with a rowtype column

2012-03-20 Thread Merlin Moncure
On Tue, Mar 20, 2012 at 12:16 PM, Robert Haas wrote: > I think Tom's correct about what the right behavior would be if > composite types supported defaults, but they don't, never have, and > maybe never will.  I had a previous argument about this with Tom, and > lost, though I am not sure that any

Re: [BUGS] [GENERAL] Altering a table with a rowtype column

2012-03-20 Thread Tom Lane
Robert Haas writes: > On Wed, Mar 7, 2012 at 3:49 PM, Merlin Moncure wrote: >> On Wed, Mar 7, 2012 at 2:31 PM, Tom Lane wrote: >>> It is not a bug. The ALTER ADD ... DEFAULT ... form implies rewriting >>> every existing tuple of the rowtype to insert a non-null value in the >>> added column, an

Re: [BUGS] [GENERAL] Altering a table with a rowtype column

2012-03-08 Thread Merlin Moncure
On Wed, Mar 7, 2012 at 2:49 PM, Merlin Moncure wrote: > On a practical level, the error blocks nothing -- you can bypass it > trivially.   It's just an annoyance that prevents things that users > would like to be able to do with table row types.  So I'd argue to > remove the check, although I can

Re: [BUGS] [GENERAL] Altering a table with a rowtype column

2012-03-07 Thread Merlin Moncure
On Wed, Mar 7, 2012 at 2:31 PM, Tom Lane wrote: > Merlin Moncure writes: >> On Wed, Mar 7, 2012 at 11:45 AM, Mike Blackwell >> wrote: >>> alter table a add column even_more_stuff boolean not null default false; > >> aha! that's not what you posted last time.  you appended 'not null >> default f

Re: [BUGS] [GENERAL] Altering a table with a rowtype column

2012-03-07 Thread Alvaro Herrera
Excerpts from Tom Lane's message of mié mar 07 17:31:32 -0300 2012: > This probably could be done for rowtype columns as well, but nobody has > collected the necessary round tuits. I think there was some fear of > locking/deadlock issues, too. It's probably easy to do if you require it to be ma

Re: [BUGS] [GENERAL] Altering a table with a rowtype column

2012-03-07 Thread Tom Lane
Merlin Moncure writes: > On Wed, Mar 7, 2012 at 11:45 AM, Mike Blackwell > wrote: >> alter table a add column even_more_stuff boolean not null default false; > aha! that's not what you posted last time. you appended 'not null > default false'; which inexplicably breaks the ALTER. > try this:

Re: [BUGS] [GENERAL] Altering a table with a rowtype column

2012-03-07 Thread Merlin Moncure
On Wed, Mar 7, 2012 at 1:17 PM, Mike Blackwell wrote: > As a followup, the workaround fails if there is data in the source table due > to the initial null value placed in the existing data rows. > > [wcs1459@aclnx-cisp01 ~]$ psql --port=5433 -e -f x > begin; > BEGIN > create table a ( >   id seria

Re: [BUGS] [GENERAL] Altering a table with a rowtype column

2012-03-07 Thread Merlin Moncure
On Wed, Mar 7, 2012 at 11:45 AM, Mike Blackwell wrote: > > works for me -- what version are you on? > > merlin > > -- > > [wcs1459@aclnx-cisp01 ~]$ psql --version > psql (PostgreSQL) 9.1.1 > contains support for command-line editing > > > [wcs1459@aclnx-cisp01 ~]$ cat x > create table a ( >