Re: check constriaint for BLOB

From: "Aasmund Midttun Godal" <postgresql(at)envisity(dot)com>
To: howieshouse(at)home(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: check constriaint for BLOB
Date: 2001-11-27 19:40:18
Message-ID: 20011127194018.1163.qmail@213-145-170-138.dd.nextgentel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

CREATE FUNCTION lo_size (OID) RETURNS NUMERIC AS 'SELECT sum(octet_length(data)) FROM pg_largeobject WHERE loid = $1 GROUP BY (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(at)home(dot)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(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Aasmund Midttun
> Godal
> Sent: Monday, November 26, 2001 5:02 PM
> To: howieshouse(at)home(dot)com
> Cc: pgsql-general(at)postgresql(dot)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(at)home(dot)com> wrote:
>
> Aasmund Midttun Godal
>
> aasmund(at)godal(dot)com - http://www.godal.com/
> +47 40 45 20 46
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

Aasmund Midttun Godal

aasmund(at)godal(dot)com - http://www.godal.com/
+47 40 45 20 46

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Trond Eivind =?iso-8859-1?q?Glomsr=F8d?= 2001-11-27 19:59:20 Re: Postgres 7.1.3 RPMs for RedHat 6.2 ?
Previous Message Fran Fabrizio 2001-11-27 19:07:49 Adding a rule makes my sequence increment twice