PHP.nl

pg_last_notice

pg_last_notice

Returns the last notice message from PostgreSQL server

 **pg_last_notice** PgSql\Connection $connection int $mode
returns the last notice

message from the PostgreSQL server on the specified . The PostgreSQL server sends notice messages in several cases, for instance when creating a column in a table. pg_last_notice``connection``SERIAL

With , you can avoid issuing useless queries by checking whether or not the notice is related to your transaction. pg_last_notice

Notice message tracking can be set to optional by setting 1 for in php.ini. pgsql.ignore_notice

Notice message logging can be set to optional by setting 0 for in php.ini. Unless is set to 0, notice message cannot be logged. pgsql.log_notice``pgsql.ignore_notice

connection``mode One of (to return last notice), (to return all notices), or (to clear notices). PGSQL_NOTICE_LAST``PGSQL_NOTICE_ALL``PGSQL_NOTICE_CLEAR

A containing the last notice on the given with , an with , a with . string``connection``PGSQL_NOTICE_LAST``array``PGSQL_NOTICE_ALL``bool``PGSQL_NOTICE_CLEAR

Voorbeeld: example

<?php
  $pgsql_conn = pg_connect("dbname=mark host=localhost");
  
  $res = pg_query("CREATE TABLE test (id SERIAL)");
  
  $notice = pg_last_notice($pgsql_conn);
  
  echo $notice;
?>
CREATE TABLE will create implicit sequence "test_id_seq" for "serial" column "test.id"

pg_query``pg_last_error