Home » Database » DB » Bug #135
DB_pgsql: invalid replacing of sequence names
Details
| Submitted | 2003-10-22 07:54 UTC |
|---|---|
| From | rene at osta dot ee |
| Assigned | danielc |
| Status | Closed |
| Package | DB |
| PHP Version | 4.3.3 |
| OS | Linux 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)