PostgreSQL Functions (PDO_PGSQL)

- « PDO_ODBC DSN

- PDO_PGSQL DSN »

- PHP Manual
- PDO Drivers
- PostgreSQL Functions (PDO_PGSQL)

# PostgreSQL Functions (PDO_PGSQL)

## Introduction

PDO_PGSQL is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to PostgreSQL databases.

## Resource Types

This extension defines a stream resource returned by PDO::pgsqlLOBOpen().

## Installation

Use --with-pdo-pgsql[=DIR] to install the PDO PostgreSQL extension, where the optional `[=DIR]` is the PostgreSQL base install directory, or the path to pg_config.

    $ ./configure --with-pdo-pgsql

## Predefined Constants

The constants below are defined by this driver, and will only be available when the extension has been either compiled into PHP or dynamically loaded at runtime. In addition, these driver-specific constants should only be used if you are using this driver. Using driver-specific attributes with another driver may result in unexpected behaviour. PDO::getAttribute() may be used to obtain the `PDO::ATTR_DRIVER_NAME` attribute to check the driver, if your code can run against multiple drivers.

`PDO::PGSQL_ATTR_DISABLE_PREPARES` (int)

  Send the query and the parameters to the server together in a single call, avoiding the need to create a named prepared statement separately. If the query is only going to be executed once this can reduce latency by avoiding an unnecessary server round-trip.

## General notes

> Note:

> `bytea` fields are returned as streams.

## Table of Contents

- PDO_PGSQL DSN — Connecting to PostgreSQL databases
- PDO::pgsqlCopyFromArray — Copy data from PHP array into table
- PDO::pgsqlCopyFromFile — Copy data from file into table
- PDO::pgsqlCopyToArray — Copy data from database table into PHP array
- PDO::pgsqlCopyToFile — Copy data from table into file
- PDO::pgsqlGetNotify — Get asynchronous notification
- PDO::pgsqlGetPid — Get the server PID
- PDO::pgsqlLOBCreate — Creates a new large object
- PDO::pgsqlLOBOpen — Opens an existing large object stream
- PDO::pgsqlLOBUnlink — Deletes the large object