I'm getting the following err in PostgreSQL logs :
2014-09-22 11:25:57 CEST LOG: execute 45STM: DECLARE "44STM" CURSOR WITH HOLD FOR SELECT NEXTVAL('SEQ_DBSTATE');
2014-09-22 11:25:57 CEST LOG: execute 46STM: FETCH FORWARD 50 FROM "44STM"
2014-09-22 11:25:57 CEST LOG: execute 46STM: FETCH FORWARD 50 FROM "44STM"
2014-09-22 11:25:57 CEST LOG: statement: CLOSE "44STM"
2014-09-22 11:25:57 CEST ERROR: syntax error at or near ";" at character 54
2014-09-22 11:25:57 CEST STATEMENT: SELECT COUNT(*) FROM (
SELECT NEXTVAL('SEQ_DBSTATE');
) A
I don't know what's going on. Some tool is wrapping the sql generated by Aureilus with a "Select count(*) From". This is not generated by Aurelius. All PostgreSQL tests passed here, and what you are trying to achieve is a very basic operation
But of course that's just avoiding the problem i'm facing.
Maybe the issue is in the .BuildDatabase() step. I don't see that the ID defined as using seq_dbstate. Does it mean Aurelius "remember" the sequence it should use for this precise field?
PostgreSQL supports both serial and sequences, and Aurelius choice is using sequences for several reasons. Actually, by the way, Serial field in PostgreSQL is not a real field. It's an alias, internally it creates an integer field, an internal sequence and an internal trigger, so it actually uses sequences.
Yes, it associates the sequence with the table. Might be a problem with firedac, but only if you are using some different settings in TFDConnection, because we run all our tests here with firedac as well and we don't see any issue.
What can be done is that we remove the final ";" from the statements, this could make it work for you. But the root of the problem should be found anyway, some tool should detect a trailing ";" and remove it.
the problem is that this param make FD use a statement like following to get the count of the executed query (so you can have the correct .recordCount property value)
SELECT COUNT(*) FROM (<original SQL command text>)
We have to deal with this incompatibility.
Can you do something about it in Aurelius's FireDAC driver to avoid this?
I set this option deliberately and i'd like not to change it so i don't have to go through the whole process of testing my whole legacy app against the 4 DBMS it support.
Yes, it's possible. I think it's just a matter of removing the trailing ";" from SQL statements. Please send me a direct e-mail (wagner at tms) so I can send you the patch.