Can I create a TYPE (or DOMAIN) with arguments?

From: "R(dot)A(dot)" <adeveloper(at)bluebottle(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Can I create a TYPE (or DOMAIN) with arguments?
Date: 2008-01-09 09:53:00
Message-ID: 1199872380.4784997c65ec5@mail.bluebottle.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I'm trying to create a composite type with an argument, to create one field of this type like character varying(x), but I don't know if this can be done with PostgreSQL. I want something like:
CREATE TYPE mytype AS (
tx character varying(x),
t2nd integer
);
I need to limit the number of chars in this field tx. And different lengths will be used when creating tables with this type (so a Domain will suffer the same problem). I'm not looking for a solution like a separate column with maxChars and a Check, because lots of columns will be required (and others design reasons).

Any suggestions?

Thanks.

----------------------------------------------------------------------
Free pop3 email with a spam filter.
http://www.bluebottle.com/tag/5

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Antonio Muñoz 2008-01-09 10:00:19 data transfer/migrate from win to linux
Previous Message Dann Corbit 2008-01-09 09:39:34 Re: count(*) and bad design was: Experiences with extensibility