pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Restriction on comments
2+ messages / 2 participants
[nested] [flat]

* Restriction on comments
@ 2022-10-21 05:49 PG Doc comments form <noreply@postgresql.org>
  2022-10-21 09:50 ` Re: Restriction on comments Daniele Varrazzo <daniele.varrazzo@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Doc comments form @ 2022-10-21 05:49 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: maccaroo@gmail.com

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/15/sql-comment.html
Description:

I've recently been converting some DML which was intended for BigQuery to
use PostgreSQL 14.  Using a python client (using sqlalchemy and the
postgresql+psycopg2 driver), I had successfully created a table and was
trying to add comments to the columns.  All of this was previously done in a
single statement on BigQuery, but requires separate CREATE TABLE and COMMENT
ON COLUMN statements for PostgreSQL.

For one of the comment statements I received this error: "dict is not a
sequence".  It turns out the culprit was that one of the comments had a '%'
character.  I'm not familiar with restrictions on strings in PostgreSQL, but
it would be helpful to have a list of these.


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Restriction on comments
  2022-10-21 05:49 Restriction on comments PG Doc comments form <noreply@postgresql.org>
@ 2022-10-21 09:50 ` Daniele Varrazzo <daniele.varrazzo@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Daniele Varrazzo @ 2022-10-21 09:50 UTC (permalink / raw)
  To: maccaroo@gmail.com; pgsql-docs@lists.postgresql.org

On Fri, 21 Oct 2022 at 09:23, PG Doc comments form
<noreply@postgresql.org> wrote:
>
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/15/sql-comment.html
> Description:
>
> I've recently been converting some DML which was intended for BigQuery to
> use PostgreSQL 14.  Using a python client (using sqlalchemy and the
> postgresql+psycopg2 driver), I had successfully created a table and was
> trying to add comments to the columns.  All of this was previously done in a
> single statement on BigQuery, but requires separate CREATE TABLE and COMMENT
> ON COLUMN statements for PostgreSQL.
>
> For one of the comment statements I received this error: "dict is not a
> sequence".  It turns out the culprit was that one of the comments had a '%'
> character.  I'm not familiar with restrictions on strings in PostgreSQL, but
> it would be helpful to have a list of these.

This is likely not coming from PostgreSQL. Psycopg uses `%s` as a
placeholder. As a consequence, if you want to pass a literal `%`, you
have to escape it at `%%`.

See documentation at
https://www.psycopg.org/docs/usage.html#passing-parameters-to-sql-queries

-- Daniele





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2022-10-21 09:50 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-10-21 05:49 Restriction on comments PG Doc comments form <noreply@postgresql.org>
2022-10-21 09:50 ` Daniele Varrazzo <daniele.varrazzo@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox