PG_LAST_NOTICE(3)PG_LAST_NOTICE(3)pg_last_notice - Returns the last notice message from PostgreSQL serverSYNOPSIS
string pg_last_notice (resource $connection)
DESCRIPTION pg_last_notice(3) returns the last notice message from the PostgreSQL server on the specified $connection. The PostgreSQL server sends
notice messages in several cases, for instance when creating a SERIAL column in a table.
With pg_last_notice(3), you can avoid issuing useless queries by checking whether or not the notice is related to your transaction.
Notice message tracking can be set to optional by setting 1 for pgsql.ignore_notice in php.ini.
Notice message logging can be set to optional by setting 0 for pgsql.log_notice in php.ini. Unless pgsql.ignore_notice is set to 0, notice
message cannot be logged.
PARAMETERS
o $connection
- PostgreSQL database connection resource.
RETURN VALUES
A string containing the last notice on the given $connection, or FALSE on error.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 4.3.0 | |
| | |
| | This function is now fully implemented. Earlier |
| | versions ignores database connection parameter. |
| | |
| 4.3.0 | |
| | |
| | The pgsql.ignore_notice and pgsql.log_notice |
| | php.ini directives were added. |
| | |
| 4.0.6 | |
| | |
| | PHP 4.0.6 has problem with notice message han- |
| | dling. Use of the PostgreSQL module with PHP |
| | 4.0.6 is not recommended even if you are not |
| | using pg_last_notice(3). |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
pg_last_notice(3) 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;
?>
The above example will output:
CREATE TABLE will create implicit sequence "test_id_seq" for "serial" column "test.id"
SEE ALSO pg_query(3), pg_last_error(3).
PHP Documentation Group PG_LAST_NOTICE(3)
Check Out this Related Man Page
PG_PARAMETER_STATUS(3)PG_PARAMETER_STATUS(3)pg_parameter_status - Looks up a current parameter setting of the server.SYNOPSIS
string pg_parameter_status ([resource $connection], string $param_name)
DESCRIPTION
Looks up a current parameter setting of the server.
Certain parameter values are reported by the server automatically at connection startup or whenever their values change. pg_parameter_sta-
tus(3) can be used to interrogate these settings. It returns the current value of a parameter if known, or FALSE if the parameter is not
known.
Parameters reported as of PostgreSQL 8.0 include server_version, server_encoding, client_encoding, is_superuser, session_authorization,
DateStyle, TimeZone, and integer_datetimes. ( server_encoding, TimeZone, and integer_datetimes were not reported by releases before 8.0.)
Note that server_version, server_encoding and integer_datetimes cannot change after PostgreSQL startup.
PostgreSQL 7.3 or lower servers do not report parameter settings, pg_parameter_status(3) includes logic to obtain values for server_ver-
sion and client_encoding anyway. Applications are encouraged to use pg_parameter_status(3) rather than ad hoc code to determine these val-
ues.
Caution
On a pre-7.4 PostgreSQL server, changing client_encoding via SET after connection startup will not be reflected by pg_parame-
ter_status(3).
PARAMETERS
o $connection
- PostgreSQL database connection resource. When $connection is not present, the default connection is used. The default connection
is the last connection made by pg_connect(3) or pg_pconnect(3).
o $param_name
- Possible $param_name values include server_version, server_encoding, client_encoding, is_superuser, session_authorization, Dat-
eStyle, TimeZone, and integer_datetimes.
RETURN VALUES
A string containing the value of the parameter, FALSE on failure or invalid $param_name.
EXAMPLES
Example #1
pg_parameter_status(3) example
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
echo "Server encoding: ", pg_parameter_status($dbconn, "server_encoding");
?>
The above example will output:
Server encoding: SQL_ASCII
PHP Documentation Group PG_PARAMETER_STATUS(3)