Leading comments and client applications
От | Philip Semanchuk |
---|---|
Тема | Leading comments and client applications |
Дата | |
Msg-id | 265623A4-F304-4E68-90D0-343F614DB2B7@americanefficient.com обсуждение исходный текст |
Ответы |
Re: Leading comments and client applications
Re: Leading comments and client applications Re: Leading comments and client applications |
Список | pgsql-general |
Hi, I'm trying to understand a behavior where, with our Postgres client, a leading comment in a SQL script causes the CREATEFUNCTION statement following it to be not executed. I can't figure out if this is a bug somewhere or just a misunderstandingon my part. I would appreciate some help understanding. Here's the contents of foo.sql -- -- this is a comment CREATE FUNCTION foo(bar text) RETURNS text AS $$ SELECT bar $$ LANGUAGE sql IMMUTABLE PARALLEL SAFE ; When I feed that to 'psql -f foo.sql', the function is created as I expect. In the Postgres log, the leading comment *doesn't*appear. I see the same behavior if I just copy/paste the function into psql. Our test system uses Python 3.8, SQLAlchemy 1.3.6, and psycopg 2.8.5, and when our test harness reads foo.sql and passesit to SQLAlchemy's execute(), I can see in the Postgres log that the leading comment is *not* stripped, and the functionisn't created. The server is Postgres 11. My naive interpretation is that one of the client layers (SQLAlchemy or psycopg2) should be stripping the leading commentbut isn't, but that seems like a lot of responsibility to push onto a client application. I figured that would bethe responsibility of the Postgres parser. I'd be grateful for any insights about what I'm missing. Thanks Philip
В списке pgsql-general по дате отправления: