Re: Create type - Mailing list pgsql-general

From Eric G. Miller
Subject Re: Create type
Date
Msg-id 20010227005045.A8214@calico.local
Whole thread Raw
In response to RE:Create type  (Renaud Tthonnart <thonnart@amwdb.u-strasbg.fr>)
List pgsql-general
On Tue, Feb 27, 2001 at 09:11:43AM +0100, Renaud Tthonnart wrote:
> Richard Huxton wrote:
> >
> > Sorry Renaud, I'm not sure it's clear what you're trying to do.
> > Could you post an example of what you're trying to achieve to the
> > list? That'd probably help
>
> Ok. First I wanted to use nested tables. But I think it is not
> possible.
>
> Then I decided to create a type that will made the same function, a
> type that will be like a C structure. This type would contain an
> integer and a string like (1,'aaa'). Then I would have made a list or
>
> an array with this type.  Am I clear? Sorry if not, my English is
> poor.

I think the original question still stands.  What are you trying do?
Can't you map your "structure" to a regular table?  A list of struct's
containing one integer and one string sounds like a table containing
one integer and one string (with the possible addition of an extra
key field if the integer is not already an identifier).

CREATE TABLE list_struct (
  i  integer NOT NULL,
  c  varchar(255) NOT NULL
      CHECK (char_length(c) > 0),
  PRIMARY KEY (i, c)
);

--
Eric G. Miller <egm2@jps.net>

pgsql-general by date:

Previous
From: Renaud Tthonnart
Date:
Subject: RE:Create type
Next
From: Jose Manuel Lorenzo Lopez
Date:
Subject: Re: Permission denied while insert