php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71998 Function pg_insert does not insert when column type = inet
Submitted: 2016-04-09 15:40 UTC Modified: 2016-04-09 15:43 UTC
From: jaroslav_cerny at centrum dot cz Assigned:
Status: Closed Package: PostgreSQL related
PHP Version: 7.0.5 OS: Windows
Private report: No CVE-ID: None
 [2016-04-09 15:40 UTC] jaroslav_cerny at centrum dot cz
Description:
------------
Hello,

pg_insert fails when PostgreSQL column type is inet. Standard pg_query runs without issue.

Test script:
---------------
PostgreSQL:
CREATE TABLE tmp_statistics
(
  id integer NOT NULL,
  remote_addr inet
);

PHP:
$data = Array("id" => 1, "remote_addr" => '127.0.0.1');
$dbconn = getDB(); // open connection 
$res = pg_insert($dbconn, 'tmp_statistics', $data);   
echo pg_last_error($dbconn);
// Notice: pg_insert(): Expects NULL or string for 'inet' (remote_addr) in ...
pg_query($dbconn, "insert into tmp_statistics (id, remote_addr) values (2, '127.0.0.1')"); // OK, record inserted

Expected result:
----------------
Two inserted records

Actual result:
--------------
Only second record is inserted

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-09 15:43 UTC] jaroslav_cerny at centrum dot cz
PostgreSQL 9.5.2, 64bit
 [2016-04-10 16:50 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b4ab0effc76385a3e1d7cded722a27481019b481
Log: Fixed bug #71998 Function pg_insert does not insert when column type = inet
 [2016-04-10 16:50 UTC] ab@php.net
-Status: Open +Status: Closed
 [2016-07-20 11:32 UTC] davey@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b4ab0effc76385a3e1d7cded722a27481019b481
Log: Fixed bug #71998 Function pg_insert does not insert when column type = inet
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 08:01:29 2024 UTC