---
name: "CGI::Session::PostgreSQL"
section: "3pm"
platform: "linux"
package: "libcgi-session-perl"
version: "3.95-2"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/CGI::Session::PostgreSQL"
---

# CGI::Session::PostgreSQL(3pm)

PostgreSQL driver for CGI::Session

## NAME

CGI::Session::PostgreSQL - PostgreSQL driver for CGI::Session

## SYNOPSIS

```
    use CGI::Session;
    $session = new CGI::Session("driver:PostgreSQL", undef, {Handle=>$dbh});
```

For more examples, consult CGI::Session manual

## DESCRIPTION

CGI::Session::PostgreSQL is a CGI::Session driver to store session data in a PostgreSQL table. To write your own drivers for **CGI::Session** refere CGI::Session manual.

## STORAGE

To store session data in PostgreSQL database, you first need to create a suitable table for it with the following command:

```
    CREATE TABLE sessions (
        id CHAR(32) NOT NULL,
        a_session TEXT NOT NULL
    );
```

You can also add any number of additional columns to the table, but the above "id" and "a\_session" are required. If you want to store the session data in other table than "sessions", you will also need to specify **TableName** attribute as the first argument to *new()*:

```
    use CGI::Session;
```

```
    $session = new CGI::Session("driver:PostgreSQL", undef,
                                                {Handle=>$dbh, TableName=>'my_sessions'});
```

Every write access to session records is done through PostgreSQL own row locking mechanism, enabled by \`FOR UPDATE' clauses in SELECTs or implicitly enabled in UPDATEs and DELETEs.

## COPYRIGHT

Copyright (C) 2002 Cosimo Streppone. All rights reserved.

This library is free software and can be modified and distributed under the same terms as Perl itself.

## AUTHOR

Cosimo Streppone \<cosimo@cpan.org\>, heavily based on the CGI::Session::MySQL driver by Sherzod Ruzmetov, original author of CGI::Session.

## SEE ALSO

- •

  CGI::Session - CGI::Session manual

- •

  CGI::Session::Tutorial - extended CGI::Session manual

- •

  CGI::Session::CookBook - practical solutions for real life problems

- •

  **RFC 2965** - "HTTP State Management Mechanism" found at ftp://ftp.isi.edu/in-notes/rfc2965.txt

- •

  CGI - standard CGI library

- •

  Apache::Session - another fine alternative to CGI::Session
