#34920 [Opn->Fbk]: pg_update fails
ID: 34920
Updated by: tony2001@php.net
Reported By: n dot j dot saunders at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: PostgreSQL related
Operating System: Windows XP
PHP Version: 5.0.5
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
If you still able to reproduce it - please provide a short but complete
reproduce code and take a look into the Apache logs (if there are any
entries related to the problem - paste some of them here).
Previous Comments:
------------------------------------------------------------------------
[2005-10-19 21:44:35] n dot j dot saunders at gmail dot com
Description:
------------
pg_update seems to fail when updating an columns of a user defined
domain.
I have inherited table (advertisers) that contains, among others, the
columns telephone_country (integer), telephone_area (area domain),
telephone_number (number domain).
pg_update succeeds when VARCHAR fields are updated, but seems to fail
without error when fields of user defined domains are updated from the
array
Reproduce code:
---------------
1. Define a Domain in an existing postgres database
e.g: area_code, domain with check
CREATE DOMAIN "public"."area_code" AS
varchar(10) NULL;
ALTER DOMAIN "public"."area_code"
ADD CONSTRAINT "ck_area_code" CHECK ((VALUE)::text ~
'^\\(?[0-9]\\)?[0-9]*$'::text);
2. Define a table in a postgres database that includes a column of the
type you just created.
CREATE TABLE "public"."users" (
"username" VARCHAR(20) NOT NULL,
"altphone_area" "public"."area_code);
3. Create a record in the table
INSERT INTO users (username, altphone_area) VALUES ('Neil',222);
3. Try and use pg_update to update this record
pg_update($db, "users", array('altphone_area'=>444),
array('username'=>'Neil'));
Expected result:
----------------
The record you created is updated, setting the value of
altphone_area=444
Actual result:
--------------
Nothing. No updates, no error messages.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34920&edit=1
Thread (9 messages)