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

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

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Mike Blackwell <mike(dot)blackwell(at)rrd(dot)com>, pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>, PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: [GENERAL] Altering a table with a rowtype column
Date: 2012-03-20 19:07:10
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugspgsql-general
On Tue, Mar 20, 2012 at 12:16 PM, Robert Haas <robertmhaas(at)gmail(dot)com> 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 anyone other than Tom thinks that the
> current behavior is for the best.  But see commits
> a06e41deebdf74b8b5109329dc75b2e9d9057962 and
> a40b1e0bf32b1da46c1baa9bc7da87f207cd37d8.

I'll go further than that -- given the current infrastructure I'd say
that composite type defaults are not very well defined or useful
besides not being implemented. The way things work now:

create type foo as(a int, b int);
create table bar(f foo default row(1,2));

works perfectly ok.  how would you proxy the default from one of those
two columns?  does it make sense to do so?  defaults are applied to
table columns, not to types (you could argue that domains violate that
rule but IMO it's not the same thing).

type constraints are another matter.  this would be useful and
valuable but may end up being impossible to add for a lot of reasons
such as backwards compatibility and dealing with the standard's lack
(implemented nowhere in postgres except for the very special case of
IS NULL) of distinguishing between the type itself being null and it's
fields being null (making type constraints smack into plpgsql variable


In response to

pgsql-bugs by date

Next:From: Alexander LAWDate: 2012-03-20 19:50:14
Subject: Re: BUG #6510: A simple prompt is displayed using wrong charset
Previous:From: Tom LaneDate: 2012-03-20 18:48:46
Subject: Re: [GENERAL] Altering a table with a rowtype column

pgsql-general by date

Next:From: Bryan MontgomeryDate: 2012-03-20 19:16:10
Subject: Re: Authenticating from a web service call
Previous:From: Bruce MomjianDate: 2012-03-20 18:58:20
Subject: Re: pg_upgrade + streaming replication ?

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