pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nekta Katz <nekta_k@hotmail.com>
To: tgl@sss.pgh.pa.us
Cc: pgsql-sql@postgresql.org
Subject: Re: cast lo to oid
Date: Fri, 08 Nov 2002 11:24:12 +1100
Message-ID: <F123QWBLYu7AHfo98xK00000a9a@hotmail.com> (raw)

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@sss.pgh.pa.us>
>To: "Nekta Katz" <nekta_k@hotmail.com>
>CC: pgsql-sql@postgresql.org
>Subject: Re: [SQL] cast lo to oid Date: Thu, 07 Nov 2002 10:16:21 -0500
>
>"Nekta Katz" <nekta_k@hotmail.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
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org


_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail




view thread (4+ messages)

Message-ID: <F123QWBLYu7AHfo98xK00000a9a@hotmail.com>
Permalink:  ../F123QWBLYu7AHfo98xK00000a9a@hotmail.com/
Also on:    postgresql.org/message-id/F123QWBLYu7AHfo98xK00000a9a@hotmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: nekta_k@hotmail.com, tgl@sss.pgh.pa.us
  Subject: Re: cast lo to oid
  In-Reply-To: <F123QWBLYu7AHfo98xK00000a9a@hotmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox