Edgewall Software
Modify

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#10368 closed defect (fixed)

Improve quoting in sequences (PostgreSQL backend)

Reported by: sterkrig@… Owned by: sterkrig@…
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)

pgdb_seq_quoting.patch (827 bytes ) - added by sterkrig@… 11 years ago.
Patch quoting sequence name in PostgreSQL backend

Download all attachments as: .zip

Change History (8)

by sterkrig@…, 11 years ago

Attachment: pgdb_seq_quoting.patch added

Patch quoting sequence name in PostgreSQL backend

comment:1 by Remy Blank, 11 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?

comment:2 by sterkrig@…, 11 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.

in reply to:  2 ; comment:3 by Remy Blank, 11 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.

in reply to:  3 ; comment:4 by sterkrig@…, 11 years ago

Replying to rblank:

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.

That's PostgreSQL requirement, see official documentation. Or have I misunderstood you?

in reply to:  4 comment:5 by Remy Blank, 11 years ago

Milestone: 0.12.3
Owner: set to Remy Blank

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 Remy Blank, 11 years ago

Resolution: fixed
Status: newclosed

Patch tested and works fine. Applied in [10808]. Thanks!

comment:7 by Remy Blank, 11 years ago

Owner: changed from Remy Blank to sterkrig@…

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain sterkrig@….
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from sterkrig@… to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.