Re: Re: I need help creating a composite type with some sort of constraints.

From: John Oyler <john(dot)m(dot)oyler(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>
Subject: Re: Re: I need help creating a composite type with some sort of constraints.
Date: 2009-11-25 19:17:57
Message-ID: 3cc9797c0911251117j3eb850d6s21a3e20b074a03d5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Nov 25, 2009 at 1:02 PM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
>
> IMO, ('abc', 'def')::foo honestly should honor constraints on foo.
> This probably isn't controversial.

So who do we need to convince to make this happen? The things we could
do with this kick ass. Maybe the details of the file I linked are
wrong, but just the idea of a short script that we could settle on as
a standard... (on the other hand, I just saw a varchar(30) for a
column named birth_date at work the other day, and we already have a
data type perfect for that, so maybe it wouldn't help at all.)

> Since starting with 8.4 you can index composite types directly, you
> could possibly make a case that a lot of built in postgresql types,
> especially geometric types, could be reimplemented as composites, and
> toss a lot of code that backs the geo types such as the various in/out
> routines.  I don't think this will ever happen for various reasons
> (backwards compatibility and possibly efficiency for example), but
> it's fun to think about.  The best way to do complex validation based
> on type in postgresql today is in C if you don't want to add
> constraints wherever the type is used.

Well, my understanding is that anything in C means that the superuser
has to declare/define it. That makes things slightly more
inconvenient, but isn't a dealbreaker.

Are there any examples of this anywhere? Could someone cook one up for
me? The docs are pretty thin on this subject, or I'm looking in the
wrong places.

Thanks,
John O.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Devrim GÜNDÜZ 2009-11-25 19:25:33 PostgreSQL RPM packages for Fedora-12 released
Previous Message Jean-Yves F. Barbier 2009-11-25 19:09:12 Re: limiting resources to users