Re: TODO Item - Return compressed length of TOAST datatypes (WIP) - Mailing list pgsql-patches

From Tom Lane
Subject Re: TODO Item - Return compressed length of TOAST datatypes (WIP)
Date
Msg-id 12845.1119105331@sss.pgh.pa.us
Whole thread Raw
In response to TODO Item - Return compressed length of TOAST datatypes (WIP)  (Mark Kirkwood <markir@paradise.net.nz>)
Responses Re: TODO Item - Return compressed length of TOAST datatypes
Re: TODO Item - Return compressed length of TOAST datatypes
List pgsql-patches
Mark Kirkwood <markir@paradise.net.nz> writes:
> I thought I would have a look at:
> (Datatypes) Add function to return compressed length of TOAST data values.

My recollection of that discussion is that we just wanted something
that would return the actual VARSIZE() of the datum.  You're building
something way too confusing ...

A more interesting point is that the way you've declared the function,
it will only work on text values, which is pretty limiting.  Ideally
we'd define this thing as "pg_datum_length(any-varlena-type) returns int"
but there is no pseudotype corresponding to "any varlena type".

I was thinking about this the other day in connection with my proposal
to make something that could return the TOAST value OID of an
out-of-line datum.  I think the only non-restrictive way to do it would
be to declare the function as taking "any", and then add a runtime check
using the get_fn_expr_argtype() mechanism to test that what you've been
given is in fact a varlena datatype.

            regards, tom lane

pgsql-patches by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: default database creation with initdb
Next
From: Tom Lane
Date:
Subject: Post-mortem: final 2PC patch