View Single Post

   
  #1 (permalink)  
Old 04-15-2008, 11:17 PM
Thomas Kellerer
 
Posts: n/a
Default CREATE FUNCTION with JDBC

Hello,

I was using a Java based front end to PG and tried to create a function
that I could use for a trigger.

CREATE OR REPLACE FUNCTION trg_func_ucase() RETURNS trigger AS
$trg$
BEGIN
NEW.name = upper(NEW.name);
END;
$trg$
language 'plpgsql';

I kept getting an error message
ERROR: unterminated dollar-quoted string at or near "$trg$

As the statement works with psql, I thought this might be a problem of my
JDBC frontend, so I create a simple test program which sends the above
string using execute() (tried executeUpdate() as well) to the database, and
I'm getting the same error.

When I use single quotes around the function body everything works fine
through plain JDBC. This means a use disadvantage for any Java based
frontend (as I have to deal with the old clumsy quoting again), and I'm
wondering if this is a bug in the driver, or simply not supposed to work.

In any case: is there any chance of getting this fixed?

I'm using PG 8.0.2 on Win2000 and the JDBC driver is 8.0-311

Cheers
Thomas




---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Reply With Quote