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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jaroslav_cerny at centrum dot cz
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Sat Apr 20 03:01:28 2024 UTC