awferreira / c5-db-migration

Automatically exported from code.google.com/p/c5-db-migration
0 stars 0 forks source link

PostgreSQL functions not supported #9

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a migration with a SQL function beginning with $PROC$
2. Execute migration

What is the expected output? What do you see instead?
Function should be imported into the database. The following exception is
thrown:
org.postgresql.util.PSQLException: ERROR: unterminated dollar-quoted string
at or near "$PROC$ BEGIN    RETURN COUNT(*) FROM table "

What version of the product are you using? On what operating system?
0.9.3

Please provide any additional information below.
I believe the error is within ScriptRunnerImpl. It incorrectly detects the
end of a statement by looking for the semi-colon ';' at the end of the
line. This is not the case when using a function.

Original issue reported on code.google.com by owen.gri...@gmail.com on 22 Oct 2008 at 9:00

GoogleCodeExporter commented 8 years ago
Patch attached.

Original comment by owen.gri...@gmail.com on 22 Oct 2008 at 9:17

Attachments:

GoogleCodeExporter commented 8 years ago
This issue can now be closed. The custom deliminator allows PostgresSQL 
functions and
proceedures.

Original comment by owen.gri...@gmail.com on 15 Jan 2009 at 10:00

GoogleCodeExporter commented 8 years ago
Owen: I'm planning on supporting the standard postgres style procedure and 
functions
in the near future, so I'm going to keep this ticket open until it's done, if 
you
don't mind.  When it's done, perhaps you can help us by giving it a test whirl? 
Thanks... Christian

Original comment by christia...@gmail.com on 19 Jan 2009 at 5:30

GoogleCodeExporter commented 8 years ago

Original comment by christia...@gmail.com on 19 Jan 2009 at 5:30

GoogleCodeExporter commented 8 years ago
Christian: I'll give it a whirl. I've got an update patch I can give you when I 
get
back into the office complete with test cases. 

Original comment by owen.gri...@gmail.com on 22 Jan 2009 at 5:32

GoogleCodeExporter commented 8 years ago
Please make sure that when functions are formatted like the one below they also 
work.  This is the format that pg_dump uses.

CREATE FUNCTION getQtyOrders(customerID int) RETURNS int 
    AS $$
DECLARE
    qty int;
BEGIN
  SELECT COUNT(*) INTO qty
    FROM Orders
      WHERE accnum = customerID;
  RETURN qty;
END;
$$ 
    LANGUAGE plpgsql;

Original comment by nik9...@gmail.com on 26 Jan 2011 at 6:20