#10368 closed defect (fixed)
Improve quoting in sequences (PostgreSQL backend)
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | 0.12.3 |
Component: | database backend | Version: | 0.12-stable |
Severity: | normal | Keywords: | postgresql, db, sequence, quoting |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
PostgreSQL backend in 0.12 (at least) still has problems with proper quoting of few queries. If we look in sequence-related code, we see that result of table
and column
concatenation is not quoted. Several plugins create such tables and columns, so I suppose they should be quoted. Patch attached.
Attachments (1)
Change History (8)
by , 13 years ago
Attachment: | pgdb_seq_quoting.patch added |
---|
comment:1 by , 13 years ago
Do you have a concrete example of a plugin failing, possibly with the traceback?
I'm not sure about the patch: double quotes within single quotes? Are you sure?
follow-up: 3 comment:2 by , 13 years ago
Do you have a concrete example of a plugin failing, possibly with the traceback?
Sure, I caught it while dealing with PeerReviewPlugin. It had to undergo lots of quoting itself, and it's not in good shape, I'll be the first to admit, but nevertheless.
I can roll back my patch and get a traceback, but what do you want to see there? Plugin/Trac/psycopg complain about non-existent lowercase-named sequence, that's all.
I'm not sure about the patch: double quotes within single quotes? Are you sure?
What's wrong with that? Python allows that kind of quoting, see quote
function in the same file for example.
follow-up: 4 comment:3 by , 13 years ago
Replying to sterkrig@…:
What's wrong with that? Python allows that kind of quoting, see
quote
function in the same file for example.
What I mean is that the sequence name is passed as a string literal to both CURRVAL()
and setval()
, so I don't understand why the name should be quoted inside the string.
follow-up: 5 comment:4 by , 13 years ago
Replying to rblank:
What I mean is that the sequence name is passed as a string literal to both
CURRVAL()
andsetval()
, so I don't understand why the name should be quoted inside the string.
That's PostgreSQL requirement, see official documentation. Or have I misunderstood you?
comment:5 by , 13 years ago
Milestone: | → 0.12.3 |
---|---|
Owner: | set to |
Replying to sterkrig@…:
That's PostgreSQL requirement, see official documentation. Or have I misunderstood you?
No, you understood correctly, and I was wrong. This quoting is strange, but correct.
So, yes, the patch looks good. Thanks!
comment:6 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Patch tested and works fine. Applied in [10808]. Thanks!
comment:7 by , 13 years ago
Owner: | changed from | to
---|
Patch quoting sequence name in PostgreSQL backend