Pg module question

I'm trying to create a table in a PostgreSQL database and I can't figure out the syntax.

The PostgreSQL site tells me
CREATE TABLE TEST (NAM VARCHAR (40), ADD VARCHAR (40), PHO VARCHAR(40));

This doesn't work ('Internal server error').

I tried $db->CREATE TABLE .....   Same error message.

I have the documentation for the module, from CPAN, but it doesn't talk about the syntax for this (or SELECT, or alot of things).

How do you create a table?

the code:

#!usr/bin/perl -w
use strict;
use DBI;
my $db = DBI->connect("dbi:pg:dbname=me;host=sql");
$db->CREATE TABLE TEST (NAM VARCHAR (40), ADD VARCHAR (40), PHO VARCHAR(40));
$db->DROP TABLE TEST;
$db->disconnect;


ardasheksAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

adam923Commented:
perl functions don't have spaces so you're missing something here, but i don't know much about DBI so check out http://www.perl.com/pub/1999/10/DBI.html
0
bigbedCommented:
your create table and drop table statements should be something like:
$db->execute('CREATE TABLE TEST (NAM VARCHAR (40), ADD VARCHAR (40), PHO VARCHAR(40)');
$db->execute('DROP TABLE TEST');

Take a look at:
http://www.perl.com/pub/1999/10/DBI.html

Does this help?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.