Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jan 9, 2008 4:53 AM, R.A. <adeveloper@xxxxxxxxxxxxxx> wrote:
> 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).

It would be really neat if you could do that, but you can't :-(.  What
you can do is make a trigger function taking mytype which and apply
the constraint that way...

merlin

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux