Re: How do I use text script containing SQL?

From: Mathijs Brands <mathijs(at)ilse(dot)nl>
To: David Olbersen <dave(at)slickness(dot)org>
Cc: "Jeff S(dot)" <pgsqluser(at)yahoo(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: How do I use text script containing SQL?
Date: 2001-03-05 22:14:13
Message-ID: 20010305231413.C22983@ilse.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, Mar 05, 2001 at 11:08:40AM -0800, David Olbersen allegedly wrote:
> On Mon, 5 Mar 2001, Jeff S. wrote:
>
> ->I want to be able to use the file to create my table.
> ->I've tried psql -d databasename -e < filename.txt
> ->but that doesn't work.
>
> You're making it too dificult :-)
> 'psql -d databasename < filename.txt' should work just fine

Strange, the syntax you used (psql -d <dbname> -e) should work...

serv0:~$ echo '\d ntree' | psql -d iig -e
Table "ntree"
Attribute | Type | Modifier
-----------+---------+----------
pid | integer |
cid | integer |
Indices: idx_ntree_cid,
idx_ntree_pid

I'm using psql 7.0.3 and I'm pretty sure it also works for 6.5.x.

Mathijs
--
It's not that perl programmers are idiots, it's that the language
rewards idiotic behavior in a way that no other language or tool has
ever done.
Erik Naggum

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Grant 2001-03-05 22:49:52 How to count elements in an array?
Previous Message Mathijs Brands 2001-03-05 22:03:56 Clustering (was Re: Optimizing Query)