edge case for determining separate sql queries #109

Closed
qwesda opened this Issue Nov 2, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@qwesda

qwesda commented Nov 2, 2015

I stumbled over an edge case for determining where a query starts and where it ends:

CREATE OR REPLACE RULE "maintein_active_tables_on_delete" AS 
ON DELETE TO "frontends"."frontend_to_release_format"
DO ALSO (
    DELETE FROM "frontends"."frontend_to_release_format_active"
    WHERE (gdid_frontend, gdid_release_format) = (old.gdid_frontend, old.gdid_release_format);
    DELETE FROM "frontends"."frontend_to_release_format_inactive"
    WHERE (gdid_frontend, gdid_release_format) = (old.gdid_frontend, old.gdid_release_format);
);
@jakob

This comment has been minimized.

Show comment
Hide comment
@jakob

jakob Nov 2, 2015

Owner

Thanks for letting me know about this. I wasn't aware that PostgreSQL statements can contain semicolons; I thought I would be spared this horror from MySQL....

But it seems the fix should be straightforward. I checked the psql source to see what they do, and they just ignore semicolons inside parentheses. So I just need to count parenthesis.

Owner

jakob commented Nov 2, 2015

Thanks for letting me know about this. I wasn't aware that PostgreSQL statements can contain semicolons; I thought I would be spared this horror from MySQL....

But it seems the fix should be straightforward. I checked the psql source to see what they do, and they just ignore semicolons inside parentheses. So I just need to count parenthesis.

@qwesda

This comment has been minimized.

Show comment
Hide comment
@qwesda

qwesda Nov 2, 2015

I was pretty surprised by this too.

Nice to hear that the fix is not too complicated - I thought it might involve a lot of unpleasant code

On 02 Nov 2015, at 21:19, Jakob Egger notifications@github.com wrote:

Thanks for letting me know about this. I wasn't aware that PostgreSQL statements can contain semicolons; I thought I would be spared this horror from MySQL....

But it seems the fix should be straightforward. I checked the psql source to see what they do, and they just ignore semicolons inside parentheses. So I just need to count parenthesis.


Reply to this email directly or view it on GitHub.

qwesda commented Nov 2, 2015

I was pretty surprised by this too.

Nice to hear that the fix is not too complicated - I thought it might involve a lot of unpleasant code

On 02 Nov 2015, at 21:19, Jakob Egger notifications@github.com wrote:

Thanks for letting me know about this. I wasn't aware that PostgreSQL statements can contain semicolons; I thought I would be spared this horror from MySQL....

But it seems the fix should be straightforward. I checked the psql source to see what they do, and they just ignore semicolons inside parentheses. So I just need to count parenthesis.


Reply to this email directly or view it on GitHub.

@jakob jakob added the started label Nov 21, 2015

@jakob

This comment has been minimized.

Show comment
Hide comment
@jakob

jakob Nov 21, 2015

Owner

I've implemented parenthesis counting in build 1253
https://eggerapps-downloads.s3.amazonaws.com/postico-1253.zip

The sample query you posted works is recognized correctly now

Owner

jakob commented Nov 21, 2015

I've implemented parenthesis counting in build 1253
https://eggerapps-downloads.s3.amazonaws.com/postico-1253.zip

The sample query you posted works is recognized correctly now

@qwesda

This comment has been minimized.

Show comment
Hide comment
@qwesda

qwesda Nov 23, 2015

works also on my end.

qwesda commented Nov 23, 2015

works also on my end.

@qwesda qwesda closed this Nov 23, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment