Re: Simple row serialization?

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Ivan Voras" <ivoras(at)freebsd(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Simple row serialization?
Date: 2008-01-26 18:45:55
Message-ID: 162867790801261045r2d0a68c4l842801a4dbbd1e78@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 26/01/2008, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Ivan Voras <ivoras(at)freebsd(dot)org> writes:
> > Andrew Dunstan wrote:
> >> Or you could possibly use some of the XML support in 8.3 for serialization.
>
> > I need this for 8.1 :)
>
> There's an even easier way in 8.3: just cast the rowtype to text.
>
> regression=# select row(1,2,false)::text;
> row
> ---------
> (1,2,f)
> (1 row)
>
> Although this won't work at the SQL level in 8.1, I think you might be
> able to accomplish the equivalent within plpgsql by assigning the
> rowtype value to a text variable.
>

you lost names :(. The best of will be support some like dictionary

so select ((row(1,2,3))::sometype)
{{a:1},{b:2},{c:3}}

Regards
Pavel Stehule

> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2008-01-26 19:12:33 Re: Truncate Triggers
Previous Message Tom Lane 2008-01-26 18:40:24 Re: Simple row serialization?