Re: cast lo to oid

From: "Nekta Katz" <nekta_k(at)hotmail(dot)com>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: cast lo to oid
Date: 2002-11-08 00:11:40
Message-ID: F74ZDgC81TbdkSmLAzt00001b97@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I didn't realize there was a contrib/lo, I only created the lo type as
described in the psqlodbc faq.

I have now installed the contrib/lo and everything is working fine.

I am using PG version 7.2

thanks.

>From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
>To: "Nekta Katz" <nekta_k(at)hotmail(dot)com>
>CC: pgsql-sql(at)postgresql(dot)org
>Subject: Re: [SQL] cast lo to oid Date: Thu, 07 Nov 2002 10:16:21 -0500
>
>"Nekta Katz" <nekta_k(at)hotmail(dot)com> writes:
> > I have the following table
>
> > create table scan_docs (
> > docid serial,
> > shipno numeric(10),
> > scan lo,
> > type text
> > );
>
> > when I try to create the following rule
>
> > create rule "delete_scan_docs_lo" as
> > on delete to "scan_docs"
> > do select lo_unlink (old.scan);
>
>Why aren't you using the trigger that type LO provides for this purpose?
>Seems rather pointless to use a nonstandard type and then ignore the
>primary (sole) feature it provides...
>
> > create rule "delete_scan_docs_lo" as
> > on delete to "scan_docs"
> > do select lo_unlink (old.scan::oid);
>
> > "psql:scan_docs_rule.sql:3: ERROR: Cannot cast type 'lo' to 'oid' "
>
>Curious, as contrib/lo provides a function that's supposed to work
>for that:
>
>-- same function, named to allow it to be used as a type coercion, eg:
>-- CREATE TABLE a (image lo);
>-- SELECT image::oid FROM a;
>--
>CREATE FUNCTION oid(lo)
>RETURNS oid
>AS 'MODULE_PATHNAME', 'lo_oid'
>LANGUAGE 'C';
>
>What PG version are you using?
>
> regards, tom lane

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

Browse pgsql-sql by date

  From Date Subject
Next Message Nekta Katz 2002-11-08 00:24:12 Re: cast lo to oid
Previous Message terry 2002-11-07 23:18:02 Re: query optimization question