The following bug has been logged online:
Bug reference: 2414
Logged by: Michael
Email address: michael.rueckert@thethirddimension.de
PostgreSQL version: 8.1
Operating system: Windows XP Pro SP2
Description: Something is missing in the PostGre-Java-Connector
Details:
Hi,
I'd found PostgreSQL for creating my private software programs. I'am using
the P.-SQL Database in many of my java programs and I think i have found a
bug in your PostgreSQL-Java-Connector.
I will try to describe my problem as best as I can:
In my software I'm using some triggers and I have programmed a tool that
reads my own SQL-Script for creating the database tables, functions...
But when I try to execute the creation of a trigger there occurs an error.
That's an example of the script, that I have created (the following will not
work, but the originally sql-statement does, when I execute it with the
PostgreSQL-Administrator-Tool):
CREATE FUNCTION exampleFunction() RETURNS trigger AS $$
DECLARE
BEGIN
DELETE FROM exTable1 WHERE (exT1_pk = 1);
DELETE FROM exTabel2 WHERE (exT2_pk = 2);
RETURN anything;
END;
$$ LANGUAGE plpgsql;
So I think the problem is that the connector only reads the statement until
the next semicolon after the delete-statement, which is part of the function
and not until the next semicolon after the "$$".
Like I already said, the statement works fine when it is executed with the
administrator, but not when this statement is executed with the connector.
The connector gives an error if it is executed:
org.postgresql.util.PSQLException: ERROR: unterminated dollar-quoted string
at or near "$$
DECLARE
BEGIN
DELETE FROM exTable1 WHERE (exT1_pk = 1)"
So, as you can see in the first example the function is terminated, but
because of the semicolon after the first delete-statement the connector
"thinks" the statement is complete...but it isn't.
Maybe you can fix it? Would be great!
Sincerely,
Michael