Hi. Last patch to database.pgsql.inc introduced prefixing of temporary tables.
This might fail if someone uses schema as a database prefix. Postgresql docs say "Temporary tables exist in a special schema, so a schema name may not be given when creating a temporary table.".
It would work if someone use "normal" prefix, e.g. "foo_", not schema prefix, e.g. "foo." (note the dot).
I understand that prefixing the table would help in some cases, but it'd make using schemas impossibile. I'm not sure which solution is better. I'll do some more research.
Comments
Comment #1
Cvbge commentedOh right.
How is prefixing or not going to change anything? The temporary tables are "local" to the current session, so other sessions do not see the temporary table, so there is no name clash.
IIRC Drupal does not use persistant connections, so there is no way of different "sites" to use the same connection.
This also applies to mysql, AFAIK.
Comment #2
Cvbge commentedAh well. Here's a patch.
Comment #3
Cvbge commentedSince we don't prefix temp tables we can't use {temp_table} syntax.
Comment #4
Cvbge commentedHere. Quoting the documentation and setting to ready to be commited:
Mysql:
Postgresql:
and
Comment #5
dries commentedSteven? (You prefixed the temporary tables.)
Comment #6
Steven commentedI added the prefixing after a thread on the lists where someone said they had to prefix the temporary tablename due to host restrictions:
http://lists.drupal.org/pipermail/development/2005-October/010944.html
Either case is rare.
Perhaps as a compromise, we could prefix in MySQL, as you're not likely to get PgSQL hosting that is bolted down that hard.
Comment #7
asimmonds commentedI did a patch (http://drupal.org/node/36420) that kept the prefixing but corrected the call. Suppose we could just use the mysql portion of the patch.
Comment #8
Cvbge commentedI'm affraid we can't prefix only for mysql and not for postgres.
After db_query_temporary() you need to use the created table, and then the code is the same for both databases, for example:
Comment #9
Cvbge commentedJust before sleep: there might be general solution for postgres (using search_path), I'll have to check tommorow.
Good night.
Comment #10
Cvbge commentedI can't find a good solution after all.
So I see two possibilities:
1. Do not prefix temporary tables (and thus "drop" people whose hosts enforce arbitrary prefix on all tables)
2. Do prefix temporary tables and disallow use of schema prefixes with postgresql (for more information about schemas in postgres see http://www.postgresql.org/docs/8.0/static/ddl-schemas.html).
Of course, as someone using postgresql, I'd prefer the first option, but it is possibile to run drupal on postgresql without using schemas (at least I didn't heard otherwise).
I don't know how many people use 4.6 with schemas, nor how many providers enforce arbitrary prefixes...
Comment #11
Steven commentedCommited to HEAD. After consideration we decided on not prefixing after all: it is a meaningless operation anyway, and hosts that enforce temp table prefixes simply need to have their set up adjusted.
Comment #12
(not verified) commented