Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 2568D633A68 for ; Fri, 29 Jan 2010 12:06:31 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 75144-08 for ; Fri, 29 Jan 2010 16:06:20 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com [209.85.218.213]) by mail.postgresql.org (Postfix) with ESMTP id 72CCE632D55 for ; Fri, 29 Jan 2010 12:06:20 -0400 (AST) Received: by bwz5 with SMTP id 5so1543223bwz.3 for ; Fri, 29 Jan 2010 08:06:19 -0800 (PST) MIME-Version: 1.0 Received: by 10.204.139.23 with SMTP id c23mr695802bku.112.1264781179203; Fri, 29 Jan 2010 08:06:19 -0800 (PST) From: Jaime Casanova Date: Fri, 29 Jan 2010 11:06:03 -0500 Message-ID: <3073cc9b1001290805w3d93cbcl906aabb8fe739a9d@mail.gmail.com> Subject: capturing errors To: pgsql-php@postgresql.org Content-Type: multipart/mixed; boundary=0015174c0c38e7b01a047e4fd00b X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.185 tagged_above=-10 required=5 tests=BAYES_40=-0.185 X-Spam-Level: X-Archive-Number: 201001/16 X-Sequence-Number: 4114 --0015174c0c38e7b01a047e4fd00b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, I'm trying to capture the error from php to show an informative message to the user but i haven't managed to get it... i'm using pg_result_error_field() but when i print it i get nothing, is there something i have to configure or what i'm doing bad. attached a little php script for testing and here is the schema the script is using (obviously the error i'm trying to catch here is unique violation) """ create table t1_fk1(col1 integer primary key); insert into t1_fk1 values(1); """ --=20 Atentamente, Jaime Casanova Soporte y capacitaci=C3=B3n de PostgreSQL Asesor=C3=ADa y desarrollo de sistemas Guayaquil - Ecuador Cel. +59387171157 --0015174c0c38e7b01a047e4fd00b Content-Type: application/x-php; name="prueba.php" Content-Disposition: attachment; filename="prueba.php" Content-Transfer-Encoding: base64 X-Attachment-Id: f_g51639nj0 PD9waHAKCSRkYmNvbm4gPSBwZ19jb25uZWN0KCJkYm5hbWU9cHJ1ZWJhcyBob3N0PWxvY2FsaG9z dCB1c2VyPXBvc3RncmVzIHBhc3N3b3JkPXBvc3RncmVzIik7CgoJJHJlc3VsdCA9IEBwZ19xdWVy eSgkZGJjb25uLCAiaW5zZXJ0IGludG8gdDFfZmsxIHZhbHVlcyAoMSkiKTsKIAkkc3FsX3N0YXRl ID0gcGdfcmVzdWx0X2Vycm9yX2ZpZWxkKCRyZXN1bHQsIFBHU1FMX0RJQUdfU1FMU1RBVEUpOwoJ ZWNobyAkc3FsX3N0YXRlOwoJaWYgKCEkcmVzdWx0KSB7CgkJJHJlczEgPSBwZ19nZXRfcmVzdWx0 KCRkYmNvbm4pOwoJCWVjaG8gcGdfcmVzdWx0X2Vycm9yX2ZpZWxkKCRyZXMxLCBQR1NRTF9ESUFH X1NFVkVSSVRZKTsKCQllY2hvIHBnX3Jlc3VsdF9lcnJvcl9maWVsZCgkcmVzMSwgUEdTUUxfRElB R19TUUxTVEFURSk7CiAgICAgICAgZWNobyBwZ19yZXN1bHRfZXJyb3JfZmllbGQoJHJlczEsIFBH U1FMX0RJQUdfTUVTU0FHRV9QUklNQVJZKTsKICAgICAgICBlY2hvIHBnX3Jlc3VsdF9lcnJvcl9m aWVsZCgkcmVzMSwgUEdTUUxfRElBR19NRVNTQUdFX0RFVEFJTCk7CiAgICAgICAgZWNobyBwZ19y ZXN1bHRfZXJyb3JfZmllbGQoJHJlczEsIFBHU1FMX0RJQUdfTUVTU0FHRV9ISU5UKTsKICAgICAg ICBlY2hvIHBnX3Jlc3VsdF9lcnJvcl9maWVsZCgkcmVzMSwgUEdTUUxfRElBR19TVEFURU1FTlRf UE9TSVRJT04pOwogICAgICAgIGVjaG8gcGdfcmVzdWx0X2Vycm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