Edgewall Software

Ticket #7600 (new defect)

Opened 4 months ago

Last modified 3 months ago

[PATCH] Trac does not send object names in quotes to PostgreSQL

Reported by: devrim@… Owned by:
Priority: normal Milestone: 0.11.3
Component: general Version: 0.12dev
Severity: normal Keywords: postgresql
Cc: felix.schwarz@…

Description

Hello,

If we create an environment with a dash sign in it, Trac fails to authenticate from PostgreSQL. The reason is that within PostgreSQL, object names cannot have - in it:

test=# CREATE TEMP TABLE t-1 (c1 int);
ERROR:  syntax error at or near "-"
LINE 1: CREATE TEMP TABLE t-1 (c1 int);

If you want to use dash, you need to double quote object name:

test=# CREATE TEMP TABLE "t-1" (c1 int);
CREATE TABLE

This is not a bug -- this is a feature. So trac needs to send all object names in double quotes to PostgreSQL.

Regards, Devrim

Attachments

postgres_quoting.patch (2.2 KB) - added by felix.schwarz@… 3 months ago.
patch against 0.11
postgres_quoting.2.patch (4.7 KB) - added by felix.schwarz@… 3 months ago.
re-did my patch, this time with unit tests

Change History

Changed 3 months ago by felix.schwarz@…

  • version changed from 0.10.5 to 0.12dev

This problem is present even in 0.11 and trunk. I attach a patch which solves the problem for me. As I did not find any unit tests in trac for testing SQL generation for specific databases, I don't attach a test case.

Changed 3 months ago by felix.schwarz@…

patch against 0.11

Changed 3 months ago by felix.schwarz@…

re-did my patch, this time with unit tests

Changed 3 months ago by felix.schwarz@…

  • summary changed from Trac does not send object names in quotes to PostgreSQL to [PATCH] Trac does not send object names in quotes to PostgreSQL
  • milestone set to 0.11.2

modifying subject to make my patch more visible

Changed 3 months ago by cboos

  • keywords postgresql added
  • milestone changed from 0.11.2 to 0.11.3

Patch looks OK, would need some double checking before applying.

Postponing to 0.11.3 but if someone feels like testing and applying it before, please do.

Changed 3 months ago by felix.schwarz@…

  • cc felix.schwarz@… added

Add/Change #7600 ([PATCH] Trac does not send object names in quotes to PostgreSQL)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from (none). Next status will be 'new'
The owner will change from (none) to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.