Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 7E143475C8B for ; Thu, 7 Nov 2002 19:24:10 -0500 (EST) Received: from hotmail.com (f123.sea1.hotmail.com [207.68.163.123]) by postgresql.org (Postfix) with ESMTP id CA73E4759AF for ; Thu, 7 Nov 2002 19:24:09 -0500 (EST) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Thu, 7 Nov 2002 16:24:12 -0800 Received: from 210.50.30.21 by sea1fd.sea1.hotmail.msn.com with HTTP; Fri, 08 Nov 2002 00:24:12 GMT X-Originating-IP: [210.50.30.21] From: "Nekta Katz" 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 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 08 Nov 2002 00:24:12.0658 (UTC) FILETIME=[29B6C520:01C286BD] X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/123 X-Sequence-Number: 10265 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 >To: "Nekta Katz" >CC: pgsql-sql@postgresql.org >Subject: Re: [SQL] cast lo to oid Date: Thu, 07 Nov 2002 10:16:21 -0500 > >"Nekta Katz" 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