PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB » Bug #135

DB_pgsql: invalid replacing of sequence names

Details

Submitted2003-10-22 07:54 UTC
Fromrene at osta dot ee
Assigneddanielc
StatusClosed
PackageDB
PHP Version4.3.3
OSLinux RH9
Roadmaps(Not assigned)

Comments

[2003-10-22 07:54 UTC] rene at osta dot ee

Description:
------------
DB_pgsql::getSequenceName behaves incorrectly by replacing /[^a-z0-9_]/i (all but numbers and letters) with _. This disables using of schemas in postgresql. sequences in other schemas are accessed by schemaname.sequencename. The . will be replaced with _ and incorrect sequence name is used when querying nextval().

Actually DB_pgsql inherits this methid from DB_common. If this is no problem for other DB engines DB_pgsql should define it's own getSequenceName, which at least does not replace dots in sequence names. It should also be considered that ANSI SQL allows also spaces in schema, table, sequence, ... names for example "My Schema"."My Sequence"

Reproduce code:
---------------
for example:
$DBC = DB::connect(....);
$DBC->setOption('seqname_format','%s');
$next_id = $DBC->nextId('myschema.mysequence');

Expected result:
----------------
$next_id should be the next value from mysequence in myschema

Actual result:
--------------
actually DB creates a new sequence named myschema_mysequence (if it does not exiost already) and selects it's nextval.

[2004-06-07 13:20 UTC] sintemaa at hotmail dot com

Where has this fix gone. In which version of which file in CVS it has been fixed, cause I can not find the fixed file in CVS, and I have the same problem in DB with oci8 backend.

[2004-06-07 13:38 UTC] sintemaa at hotmail dot com

Never mind I had a different problem (no permission to read sequences in another schema)