Re: Add Large Object support to database programmatically

From: Richard Huxton <dev(at)archonet(dot)com>
To: acordner <alan(dot)cordner(at)hartscientific(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Add Large Object support to database programmatically
Date: 2009-09-03 21:51:44
Message-ID: 4AA03A70.6050809@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

acordner wrote:
> .CommandText = "SET search_path = public; CREATE DOMAIN lo AS
> pg_catalog.oid;" _
> & "CREATE FUNCTION lo_oid(lo) RETURNS pg_catalog.oid
> AS" _
> & "'SELECT $1::pg_catalog.oid' LANGUAGE SQL STRICT
> IMMUTABLE;" _
> & "CREATE FUNCTION lo_manage() RETURNS
> pg_catalog.trigger" _
> & "AS '$libdir/lo' LANGUAGE C;"
> Call .Execute
> End With
> Set cmdCommand = Nothing
> End Function
>
> However, when I execute this code, I get a SQL "syntax error at or near
> '$libdir/lo'" and the contrib module is not loaded.

Turn statement logging on server-side and you'll see what's happening.

My VB isn't the greatest, but doesn't the "_" join together multi-line
strings? In which case you don't need the "&".

However, it looks to me like the actual problem is that you're missing
some spaces/newlines and getting SQL like:
RETURNS pg_catalog.triggerAS '$libdir/lo'

Turn up your server logging and you'll know for sure.
--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2009-09-03 22:02:50 Re: query speed question
Previous Message Christopher Condit 2009-09-03 21:11:37 query speed question