pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeremy Buchmann <jeremy@wellsgaming.com>
To: David Coley <davidcoley@home.com>
To: pgsql-interfaces@postgresql.org
Subject: Re: Create tables using Perl DBI
Date: Tue, 21 Nov 2000 12:38:41 -0800
Message-ID: <200011212037.MAA16763@mail.greatbasin.net> (raw)

>$sth = $dbh->prepare("create table customer (ID serial PRIMARY KEY, name
>text NOT NULL,      email text NOT NULL, phone text NOT NULL, fax text
>DEFAULT, address     text NOT NULL, address2 text DEFAULT, zip text NOT
>NULL, city text     NOT NULL, state text NOT NULL, country text NOT NULL")
>or die "Could not Create Table: $DBI::errstr";

It looks like you're missing a ")" in there somewhere.
Parse error usually = syntax error.

--
Jeremy Buchmann
System Admin/Database Programmer
Wells Gaming Research

----------
>From: "David Coley" <davidcoley@home.com>
>To: <pgsql-interfaces@postgresql.org>
>Subject: [INTERFACES] Create tables using Perl DBI
>Date: Mon, Nov 20, 2000, 12:50 PM
>

> I've been trying to learn how to use PostgreSQL and Perl together on a test
> machine at work.  My problem is that I can not seem to get it working.  The
> documentation on the subject don't seem to be that in-depth and tutorials
> seem lacking :)
>
> Below is my third or forth try at getting my database to connect and create
> a table.  I've included the error code for the code snippet.  Any help would
> be GREATLY appreciated.
>
>
> === Begin Code ===
>
> #!/usr/bin/perl
>
> # Use the Database Binding Interface
> use DBI;
>
> # We want to use the  database which is kwsclient
> $dbh = DBI->connect("dbi:Pg:dbname=kwsclient","db","PASSWORD")
>  or die "Connecting: $DBI::errstr";
>
> #abcdefghijklmnopqrstuvwxyz
> $sth = $dbh->prepare("create table customer (ID serial PRIMARY KEY, name
> text NOT NULL,      email text NOT NULL, phone text NOT NULL, fax text
> DEFAULT, address     text NOT NULL, address2 text DEFAULT, zip text NOT
> NULL, city text     NOT NULL, state text NOT NULL, country text NOT NULL")
>    or die "Could not Create Table: $DBI::errstr";
> $sth->execute;
> #disconnect from the database.
> $dbh->disconnect();
> # END
>
> === End Code ===
>
> === Error Message ===
> DBD::Pg::st execute failed: ERROR:  parser: parse error at or near ","
>
>
> Thanks for the help.
>
> David Coley
> davidcoley@home.com
> http://www.davidcoley.com
>
> 



view thread (7+ messages)  latest in thread

Message-ID: <200011212037.MAA16763@mail.greatbasin.net>
Permalink:  ../200011212037.MAA16763@mail.greatbasin.net/
Also on:    postgresql.org/message-id/200011212037.MAA16763@mail.greatbasin.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: jeremy@wellsgaming.com, davidcoley@home.com
  Subject: Re: Create tables using Perl DBI
  In-Reply-To: <200011212037.MAA16763@mail.greatbasin.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox