RE: [HACKERS] Happy column dropping

From: Don Baccus <dhogaza(at)pacifier(dot)com>
To: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, "PostgreSQL Development" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: RE: [HACKERS] Happy column dropping
Date: 2000-01-25 04:50:03
Message-ID: 3.0.1.32.20000124205003.00f6fac0@mail.pacifier.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 12:22 PM 1/25/00 +0900, Hiroshi Inoue wrote:
>> -----Original Message-----
>> From: Don Baccus [mailto:dhogaza(at)pacifier(dot)com]

>> This would appear to be (at least one reason) why you can't add a
>> "not null"
>> constraint to a column you're adding to an existing relation, or set the
>> new column to some non-null default value.
>>
>> Correct? (again, to see if my eyeballs and brain are working in synch
>> tonight)

>Probably yes.
>Adding NOT NULL constraints to new column needs to apply default
>value to existent rows and this would need either implicit updation of
>existent rows or to copy into different version of the relation file. .

Right...and my reading says neither happens.

(and I'm not arguing that either should, I posed my question as a reality
check as to whether or not a pedantic, lame-brain like myself is actually
capable of reading and understanding the code)

>Do other DBMSs allow such things ?

Don't know, haven't researched it. I think it's a reasonable restriction,
though.

>For example,in Oracle NOT NULL constraint could be specified for new
>column only when there's no row in the table AFAIK.

I think that's right.

>I couldn't judge it's worth the work.

Gosh, and I hope you didn't think I was suggesting it was. I was simply
responding to Tom's saying that "ADD/DROP column" would require a new
file for the updated relation, and asking if the current situation was
slated for change (because the current situation doesn't require that
the relation be copied to a new file after a "alter table add column",
if I read the code right).

That's all...I just wasn't able to relate Tom's point to how things
appear to work, and wondered if I was missing something crucial in my
reading of the code.

- Don Baccus, Portland OR <dhogaza(at)pacifier(dot)com>
Nature photos, on-line guides, Pacific Northwest
Rare Bird Alert Service and other goodies at
http://donb.photo.net.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2000-01-25 05:00:04 Re: [HACKERS] fatal copy in/out error (6.5.3)
Previous Message Tom Lane 2000-01-25 04:46:28 Re: [HACKERS] Happy column dropping