pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gary Greenberg <gary@icontrol.com>
To: pgsql-odbc@postgresql.org
Subject: Error while creating stored procedure through ODBC connection
Date: Thu, 25 Jan 2007 11:35:12 -0800
Message-ID: <00df01c740b7$f08af5a0$b80a3c0a@D9GKB4C1> (raw)

I am trying to generate a database by running DDL script through the ODBC
connection.

It went through almost to the end and then barfed on creating procedure.

Here is a snippet from the generation log:

*** Executing statement 311:

CREATE FUNCTION mask_new_permission () RETURNS trigger AS
$mask_new_permission$

    begin

        new.PERMISSION_MASK := coalesce(select 2*max(PERMISSION_MASK) from
permissions, 1)

*** Execution of statement failed:

ERROR: unterminated dollar-quoted string at or near "$mask_new_permission$

    begin

        new.PERMISSION_MASK := coalesce(select 2*max(PERMISSION_MASK) from
permissions, 1)";

Error while executing the query

SQLSTATE = 42601

 

*** Executing statement 312:

return new

*** Execution of statement failed:

ERROR: syntax error at or near "return";

Error while executing the query

SQLSTATE = 42601

 

*** Executing statement 313:

end

*** Statement successfully executed.

 

*** Executing statement 314:

$mask_new_permission$ LANGUAGE plpgsql

*** Execution of statement failed:

ERROR: unterminated dollar-quoted string at or near "$mask_new_permission$
LANGUAGE plpgsql";

Error while executing the query

SQLSTATE = 42601

 

*** Executing statement 315:

create trigger permissions_bit before insert on permissions

for each row execute procedure mask_new_permission()

*** Execution of statement failed:

ERROR: function mask_new_permission() does not exist;

Error while executing the query

SQLSTATE = 42883

 

 

When I am executing the same piece of code from psql prompt it is going
through without complaining:

ops2=> CREATE FUNCTION mask_new_permission () RETURNS trigger AS
$mask_new_permission$

ops2$>     begin

ops2$>         new.PERMISSION_MASK := coalesce(select 2*max(PERMISSION_MASK)
from permissions, 1);

ops2$>         return new;

ops2$>     end;

ops2$> $mask_new_permission$ LANGUAGE plpgsql;

CREATE FUNCTION

ops2=>

ops2=>

ops2=> create trigger permissions_bit before insert on permissions

ops2-> for each row execute procedure mask_new_permission();

CREATE TRIGGER

 

Can anyone explain it to me, please?

Thx,

            Gary

BTW, ODBC driver is PSQLODBC30A.dll

view thread (2+ messages)  latest in thread

Message-ID: <00df01c740b7$f08af5a0$b80a3c0a@D9GKB4C1>
Permalink:  ../00df01c740b7$f08af5a0$b80a3c0a@D9GKB4C1/
Also on:    postgresql.org/message-id/00df01c740b7$f08af5a0$b80a3c0a@D9GKB4C1

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: gary@icontrol.com
  Subject: Re: Error while creating stored procedure through ODBC connection
  In-Reply-To: <00df01c740b7$f08af5a0$b80a3c0a@D9GKB4C1>
  References: <00df01c740b7$f08af5a0$b80a3c0a@D9GKB4C1>

* 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