Unsupported versions: 7.4 / 7.3 / 7.2 / 7.1
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the supported versions listed above instead.

Chapter 4. pgtcl - TCL Binding Library

Table of Contents
4.1. Commands
4.2. Examples
4.3. pgtcl Command Reference Information
pg_connect -- opens a connection to the backend server
pg_disconnect -- closes a connection to the backend server
pg_conndefaults -- obtain information about default connection parameters
pg_exec -- send a query string to the backend
pg_result -- get information about a query result
pg_select -- loop over the result of a SELECT statement
pg_listen -- sets or changes a callback for asynchronous NOTIFY messages
pg_lo_creat -- create a large object
pg_lo_open -- open a large object
pg_lo_close -- close a large object
pg_lo_read -- read a large object
pg_lo_write -- write a large object
pg_lo_lseek -- seek to a position in a large object
pg_lo_tell -- return the current seek position of a large object
pg_lo_unlink -- delete a large object
pg_lo_import -- import a large object from a Unix file
pg_lo_export -- export a large object to a Unix file

pgtcl is a tcl package for front-end programs to interface with Postgres backends. It makes most of the functionality of libpq available to tcl scripts.

This package was originally written by Jolly Chen.

4.1. Commands

Table 4-1. pgtcl Commands

Command Description
pg_connect opens a connection to the backend server
pg_disconnect closes a connection
pg_conndefaults get connection options and their defaults
pg_exec send a query to the backend
pg_result manipulate the results of a query
pg_select loop over the result of a SELECT statement
pg_listen establish a callback for NOTIFY messages
pg_lo_creat create a large object
pg_lo_open open a large object
pg_lo_close close a large object
pg_lo_read read a large object
pg_lo_write write a large object
pg_lo_lseek seek to a position in a large object
pg_lo_tell return the current seek position of a large object
pg_lo_unlink delete a large object
pg_lo_import import a Unix file into a large object
pg_lo_export export a large object into a Unix file

These commands are described further on subsequent pages.

The pg_lo* routines are interfaces to the Large Object features of Postgres. The functions are designed to mimic the analogous file system functions in the standard Unix file system interface. The pg_lo* routines should be used within a BEGIN/END transaction block because the file descriptor returned by pg_lo_open is only valid for the current transaction. pg_lo_import and pg_lo_export MUST be used in a BEGIN/END transaction block.