CREATE FUNCTION lo_size (OID) RETURNS NUMERIC AS 'SELECT sum(octet_length(data)) FROM pg_largeobject WHERE loid = $1
GROUPBY (loid)' LANGUAGE 'sql';
Yes you can use largeobject - then you would something along the line of
CREATE TABLE byteaisbetter (
loid OID CHECK (lo_size(loid) > 1000000)
);
But bytea is better....
Regards,
Aasmund.
On Mon, 26 Nov 2001 18:22:49 -0800, "Howard Williams" <howieshouse@home.com> wrote:
> Thanks for the response, but...
>
> I'm using data type oid - as far as I know, that's not the same thing as
> byteA. Please correct me if I'm wrong.
>
> Howie
>
> -----Original Message-----
> From: pgsql-general-owner@postgresql.org
> [mailto:pgsql-general-owner@postgresql.org]On Behalf Of Aasmund Midttun
> Godal
> Sent: Monday, November 26, 2001 5:02 PM
> To: howieshouse@home.com
> Cc: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] check constriaint for BLOB
>
>
> CREATE TABLE testus (
> data BYTEA CHECK (octet_length(data) > 10000)
> );
> Perhaps?
>
> Regards,
>
> Aasmund.
>
> On Mon, 26 Nov 2001 15:36:28 -0800, "news.postgresql.org"
> <howieshouse@home.com> wrote:
>
> Aasmund Midttun Godal
>
> aasmund@godal.com - http://www.godal.com/
> +47 40 45 20 46
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
Aasmund Midttun Godal
aasmund@godal.com - http://www.godal.com/
+47 40 45 20 46