Re: Re: User defined type with text* field

From: Alex Pilosov <alex(at)pilosoft(dot)com>
To: Ken Kachnowich <khkachn(at)telocity(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Re: User defined type with text* field
Date: 2001-07-01 20:31:10
Message-ID: Pine.BSO.4.10.10107011630220.7004-100000@spider.pilosoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 1 Jul 2001, Ken Kachnowich wrote:

> What I want to do is create a Serialize type for storing Java objects.
> The text would be the class name and the Oid would point to the record
> where the object is stored. I need the class name and not the Oid of the
> table because of a problem I have with long class names (> 32
> characters).
>
> If I figure out how to make this a "varlena" value would variable then
> work for the length specification in the create type command?
Bytea/varlena types do not have a length, they are unlimited-length (like
text).

>
> Are there any examples of varlena user types I could look at?
>
> Thanks,
>
> Ken
>
> > Ken K <kenmail(at)telocity(dot)com> writes:
> >> I am trying to create a user defined type with 2 fields
> >> in it, a text* and an Oid. I am not sure what size to
> >> use in the create type command. When I try variable
> >> the back end core dumps. Are there any examples for
> >> doing this sort of thing? Is it even doable?
> >
> >You can't use any kind of pointer in a datatype --- what is it going to
> >point to? There's nothing it could point at that might live as long as
> >the datavalue on disk will.
> >
> >You could embed a TEXT value into a larger varlena value, say
> >
> > <total length word>
> > Oid
> > <text value here, beginning with its own length word>
> >
> >
> > regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message will trillich 2001-07-02 07:00:49 7.1 docs -- "create table"?
Previous Message Ken Kachnowich 2001-07-01 16:04:29 Re: User defined type with text* field