Ticket #733 (new defect)

Opened 19 months ago

Last modified 18 months ago

import-sql should support composite statements

Reported by: christian.schuster@… Owned by: hans
Priority: normal Milestone: To be scheduled
Component: Generator Version: 1.3.0
Severity: normal Keywords:
Cc:

Description

Hello Propellers! ;)

I'm currently using Propel with PostgreSQL. I got stuck when trying to add some multi-statement rules and UDFs with the import-sql goal:

CREATE RULE person_ins AS ON INSERT TO person DO INSTEAD (
  INSERT INTO ...;
  INSERT INTO ...
);

The PostgreSQL command line client (psql) is able to parse this. But when including the statement in one of the scripts executed by "propel-gen import-sql", the import fails with a syntax error.

The SQL processor used by import-sql seems to detect the delimiting ";" and then executes the first half of the statement.

AFAIK, there is no way to (temporarily) change the delimiter inside the SQL script. It would be somewhat nice if I could create my rules, UDFs, etc. with the "import-sql" goal.

Until then, I'll use some postponed calls to psql.

Thanks, Christian

Change History

comment:1 Changed 18 months ago by christian.schuster@…

Maybe it is possible to extend the sqldb.map reader to implement this feature. The property values could look like this:

filename.sql=datasource[,delimiter[,delimitertype]]

This would not require any modification of the current SQL file parser.

I don't know if people use comma in their data source names, or if some strange DB uses them as a delimiter. Escaping should be possible.

I'll provide a patch for that within the next few days.

Note: See TracTickets for help on using tickets.