| Extracted from Pike v7.8 release 866 at 2018-07-18.

[Top]
Postgres
Postgres.postgres

# Class Postgres.postgres

Description

  This is an interface to the Postgres database server using libpq. This module may or may not be available on your Pike, depending whether the appropriate include and library files could be found at compile-time. Note that you do not need to have a Postgres server running on your host to use this module: you can connect to the database over a TCP/IP socket.

  Please notice that unless you wish to specifically connect to a Postgres server, you'd better use the Sql.Sql , which is a server-independent sql-server-class. The interfaces to all existing sql-classes are consistent. Using Sql.Sql ensures that your Pike applications will run with any supported SQL server without changing a single line of code, at least for most common (and simple) operations.

  The program Postgres.postgres provides the raw interface to the database. Many functions are not available for this program. Therefore, its use is DEPRECATED. It is included in this documentation only for completeness' sake. Use Sql.postgres instead, or even better Sql.Sql

Note

  This driver is based on libpq and is DEPRECATED. There is a newer driver called Sql.pgsql which is faster and more robust than this driver and does not depend on any libraries.

Note

  There is no testsuite for this module, since to test anything would require a working Postgres server. You can try to use the included scripts in the "pike/src/modules/Postgres/extras" directory but you'll probably have to patch them to reflect your site's settings.

  The behavior of the Postgres C API also depends on certain environment variables defined in the environment of the pike interpreter.

  `"PGHOST"` | Sets the name of the default host to connect to. It defaults to "localhost"
  `"PGOPTIONS"` | Sets some extra flags for the frontend-backend connection. DO NOT SET unless you're sure of what you're doing.
  `"PGPORT"` | Sets the default port to connect to, otherwise it will use compile-time defaults (that is: the time you compiled the postgres library, not the Pike driver).
  `"PGTTY"` | Sets the file to be used for Postgres frontend debugging. Do not use, unless you're sure of what you're doing.
  `"PGDATABASE"` | Sets the default database to connect to.
  `"PGREALM"` | Sets the default realm for Kerberos authentication. I never used this, so I can't help you.

  Refer to the libpq documentation for further details.

See also

  Sql.Sql , Sql.postgres , Sql.postgres_result

Variable version

  `string Postgres.postgres.version`

Description

  Should you need to report a bug to the author, please submit along with the report the driver version number, as returned by this call.