Edit report at http://pear.php.net/bugs/bug.php?id=16017&edit=1

ID: 16017
Comment by: holger.schletz@web.de
Reported By: simon dot jackson at carringbush dot net
Summary: Postgres default field value metadata
Status: Feedback
Type: Bug
Package: MDB2
PHP Version: 5.2.5
Roadmap Versions:
New Comment:

This looks like a duplicate of bug #16281 for which a solution is

Previous Comments:

[2009-10-03 11:37:49] quipo

-Status: Open
+Status: Feedback
Can I have an example or a reproducing test case?


[2009-05-24 21:41:52] ifeghali

-Summary: Issue with field validation length
+Summary: Postgres default field value metadata
-Package: MDB2_Schema
+Package: MDB2

Im looping this to the MDB2 guys so we can get their thoughts on it.



[2009-03-12 07:00:08] slj

This is with PostgreSQL 8.2.

I haven't tried this with any other versions of PostgreSQL or any
versions of MySQL yet.

A default value of a single space comes back as the rather long:

' '::character varying

Alternatively, it might be possible/better to persuade
MDB2_Driver_pgsql to just pass back the actual default value (i.e. the
single space) rather than the fully enquoted and cast value. This would
remove the need to modify MDB2_Schema. On the other hand if one is
reverse engineering the metadata, it would be best to know the full
defaults value.

I confess I'm not sure which is the best way to proceed.


[2009-03-11 23:44:08] ifeghali

Hello Simon,

what RDBMS is that ? I am not sure putting database specific checks in
there is the best way to go. Let me think about that a bit more. Perhaps
you could create your own Validate class and pass it as a option ?

Igor Feghali.


[2009-03-11 08:59:50] slj

Changing the source as follows did solve the problem, but I'm not sure
that this is suitable as is for patching the source.

# diff /usr/local/horde/pear/MDB2/Schema/Validate.php
< if ( preg_match ( "/^'(.*)'::(.*)$/", $field_value, $parts
< $field_value_inner = $parts[1];
< else
< $field_value_inner = $field_value;
< if (!empty($field_def['length']) &&
strlen($field_value_inner) > $field_def['length']) {
if (!empty($field_def['length']) && strlen($field_value)
$field_def['length']) {

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
postedJan 17, '10 at 9:42a
activeJan 17, '10 at 9:42a

1 user in discussion

Holger Schletz: 1 post



site design / logo © 2022 Grokbase