{
    "mode": "perldoc",
    "parameter": "CGI::Session::Driver::postgresql",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/CGI%3A%3ASession%3A%3ADriver%3A%3Apostgresql/json",
    "generated": "2026-06-13T07:53:27Z",
    "synopsis": "use CGI::Session;\n$session = CGI::Session->new(\"driver:PostgreSQL\", undef, {Handle=>$dbh});",
    "sections": {
        "NAME": {
            "content": "CGI::Session::Driver::postgresql - PostgreSQL driver for CGI::Session\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use CGI::Session;\n$session = CGI::Session->new(\"driver:PostgreSQL\", undef, {Handle=>$dbh});\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "CGI::Session::PostgreSQL is a CGI::Session driver to store session data in a PostgreSQL table.\n",
            "subsections": []
        },
        "STORAGE": {
            "content": "Before you can use any DBI-based session drivers you need to make sure compatible database table\nis created for CGI::Session to work with. Following command will produce minimal requirements in\nmost SQL databases:\n\nCREATE TABLE sessions (\nid CHAR(32) NOT NULL PRIMARY KEY,\nasession BYTEA NOT NULL\n);\n\nand within your code use:\n\nuse CGI::Session;\n$session = CGI::Session->new(\"driver:PostgreSQL\", undef, {Handle=>$dbh, ColumnType=>\"binary\"});\n\nPlease note the *ColumnType* argument. PostgreSQL's text type has problems when trying to hold a\nnull character. (Known as \"\\0\" in Perl, not to be confused with SQL *NULL*). If you know there\nis no chance of ever having a null character in the serialized data, you can leave off the\n*ColumnType* attribute. Using a *BYTEA* column type and \"ColumnType => 'binary'\" is recommended\nwhen using Storable as the serializer or if there's any possibility that a null value will\nappear in any of the serialized data.\n\nTo use different column names, change the 'create table' statement, and then simply do this:\n\n$s = CGI::Session->new('driver:pg', undef,\n{\nTableName=>'session',\nIdColName=>'myid',\nDataColName=>'mydata',\nDataSource=>'dbi:pg:dbname=project',\n});\n\nor\n\n$s = CGI::Session->new('driver:pg', undef,\n{\nTableName=>'session',\nIdColName=>'myid',\nDataColName=>'mydata',\nHandle=>$dbh,\n});\n\nFor more details see CGI::Session::Driver::DBI, parent class.\n\nAlso see sqlite driver, which exercises different method for dealing with binary data.\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright (C) 2002 Cosimo Streppone. All rights reserved. This library is free software and can\nbe modified and distributed under the same terms as Perl itself.\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Cosimo Streppone <cosimo@cpan.org>, heavily based on the CGI::Session::MySQL driver by Sherzod\nRuzmetov, original author of CGI::Session.\n\nMatt LeBlanc contributed significant updates for the 4.0 release.\n",
            "subsections": []
        },
        "LICENSING": {
            "content": "For additional support and licensing see CGI::Session\n",
            "subsections": []
        }
    },
    "summary": "CGI::Session::Driver::postgresql - PostgreSQL driver for CGI::Session",
    "flags": [],
    "examples": [],
    "see_also": []
}