From: | Marti Raudsepp <marti(at)juffo(dot)org> |
---|---|
To: | rikard(dot)pavelic(at)zg(dot)htnet(dot)hr |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #6489: Alter table with composite type/table |
Date: | 2012-02-28 14:01:40 |
Message-ID: | CABRT9RAif=sWTUeqxjDJe6i4vpkmVVcq9Qt02XL+osPtCH=bxA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Sat, Feb 25, 2012 at 15:23, <rikard(dot)pavelic(at)zg(dot)htnet(dot)hr> wrote:
> This works:
> alter table t1 add x float not null;
> This doesn't work:
> alter table t1 add x float not null default 0;
> It fails with ERROR: cannot alter table "t1" because column "t2.j" uses its
> row type
> But I would expect second alter to pass and enforcing not null and default
> when adding this column in table and not enforcing not null and default when
> adding into composite type for another table.
>
> Is this by design, oversight or a TODO?
Peeking at the code, currently any modifications that cause a rewrite
of the original table are disallowed.
Adding a nullable column without a default is allowed since it can be
done without a rewrite -- all rows magically get the value NULL.
I'm not sure whether it's worth complicating code for this. If you
want to store composite types in tables, I think you're better off
using CREATE TYPE/ALTER TYPE.
Regards,
Marti
From | Date | Subject | |
---|---|---|---|
Next Message | luciano | 2012-02-28 15:42:51 | BUG #6496: Why the SQL is not reported as incorrect? Is there a builtin column named "name"? |
Previous Message | Pavel Stehule | 2012-02-28 08:17:02 | Re: BUG #6495: mis-sorting on string field consisting of space-padded numbers |