Actually executescreate table foo(id int) and ignores the \gdesc part as an invalid command. This works around by banning semicolons altogether unless they're the last character, in which case they'll be trimmed. Parsing the query would probably be better but it's harder to be sure it's safe that way.
It was possible to make
psql
accidentally execute statements if they ended with a semicolon. The problem:Actually executes
create table foo(id int)
and ignores the\gdesc
part as an invalid command. This works around by banning semicolons altogether unless they're the last character, in which case they'll be trimmed. Parsing the query would probably be better but it's harder to be sure it's safe that way.