pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedHow do I use text script containing SQL?
6+ messages / 6 participants
[nested] [flat]
* How do I use text script containing SQL?
@ 2001-03-05 18:56 Jeff S. <pgsqluser@yahoo.com>
2001-03-05 19:08 ` Re: How do I use text script containing SQL? David Olbersen <dave@slickness.org>
2001-03-05 19:10 ` Re: How do I use text script containing SQL? clayton cottingham <drfrog@smartt.com>
2001-03-05 19:22 ` Re: How do I use text script containing SQL? Andrew Perrin <andrew_perrin@unc.edu>
2001-03-06 01:44 ` Re: How do I use text script containing SQL? Jie Liang <jliang@ipinc.com>
0 siblings, 4 replies; 6+ messages in thread
From: Jeff S. @ 2001-03-05 18:56 UTC (permalink / raw)
To: pgsql-sql
I want to build my tables by placing all the sql
statements in a file. What is the correct way to use
this file with psql?
Example: My text file has this in it:
CREATE TABLE table1 (
table1_id serial,
field1 char(5),
PRIMARY KEY (table1_id)
);
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.
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How do I use text script containing SQL?
2001-03-05 18:56 How do I use text script containing SQL? Jeff S. <pgsqluser@yahoo.com>
@ 2001-03-05 19:08 ` David Olbersen <dave@slickness.org>
2001-03-05 22:14 ` Re: How do I use text script containing SQL? Mathijs Brands <mathijs@ilse.nl>
3 siblings, 1 reply; 6+ messages in thread
From: David Olbersen @ 2001-03-05 19:08 UTC (permalink / raw)
To: Jeff S. <pgsqluser@yahoo.com>; +Cc: pgsql-sql
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
-- Dave
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How do I use text script containing SQL?
2001-03-05 18:56 How do I use text script containing SQL? Jeff S. <pgsqluser@yahoo.com>
2001-03-05 19:08 ` Re: How do I use text script containing SQL? David Olbersen <dave@slickness.org>
@ 2001-03-05 22:14 ` Mathijs Brands <mathijs@ilse.nl>
0 siblings, 0 replies; 6+ messages in thread
From: Mathijs Brands @ 2001-03-05 22:14 UTC (permalink / raw)
To: David Olbersen <dave@slickness.org>; +Cc: Jeff S. <pgsqluser@yahoo.com>; 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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How do I use text script containing SQL?
2001-03-05 18:56 How do I use text script containing SQL? Jeff S. <pgsqluser@yahoo.com>
@ 2001-03-05 19:10 ` clayton cottingham <drfrog@smartt.com>
3 siblings, 0 replies; 6+ messages in thread
From: clayton cottingham @ 2001-03-05 19:10 UTC (permalink / raw)
To: Jeff S. <pgsqluser@yahoo.com>; +Cc: pgsql-sql
"Jeff S." wrote:
>
> I want to build my tables by placing all the sql
> statements in a file. What is the correct way to use
> this file with psql?
>
> Example: My text file has this in it:
>
> CREATE TABLE table1 (
> table1_id serial,
> field1 char(5),
> PRIMARY KEY (table1_id)
> );
>
> 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.
>
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
the syntax is
psql database < file
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How do I use text script containing SQL?
2001-03-05 18:56 How do I use text script containing SQL? Jeff S. <pgsqluser@yahoo.com>
@ 2001-03-05 19:22 ` Andrew Perrin <andrew_perrin@unc.edu>
3 siblings, 0 replies; 6+ messages in thread
From: Andrew Perrin @ 2001-03-05 19:22 UTC (permalink / raw)
To: Jeff S. <pgsqluser@yahoo.com>; +Cc: pgsql-sql
psql <databasename>
\i filename.txt
-Andy Perrin
"Jeff S." wrote:
>
> I want to build my tables by placing all the sql
> statements in a file. What is the correct way to use
> this file with psql?
>
> Example: My text file has this in it:
>
> CREATE TABLE table1 (
> table1_id serial,
> field1 char(5),
> PRIMARY KEY (table1_id)
> );
>
> 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.
>
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How do I use text script containing SQL?
2001-03-05 18:56 How do I use text script containing SQL? Jeff S. <pgsqluser@yahoo.com>
@ 2001-03-06 01:44 ` Jie Liang <jliang@ipinc.com>
3 siblings, 0 replies; 6+ messages in thread
From: Jie Liang @ 2001-03-06 01:44 UTC (permalink / raw)
To: Jeff S. <pgsqluser@yahoo.com>; +Cc: pgsql-sql
if you are a user with privalege can create table
psql -e dbname<filename.txt
Jie LIANG
St. Bernard Software
10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873
jliang@ipinc.com
www.stbernard.com
www.ipinc.com
On Mon, 5 Mar 2001, Jeff S. wrote:
> I want to build my tables by placing all the sql
> statements in a file. What is the correct way to use
> this file with psql?
>
> Example: My text file has this in it:
>
> CREATE TABLE table1 (
> table1_id serial,
> field1 char(5),
> PRIMARY KEY (table1_id)
> );
>
> 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.
>
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2001-03-06 01:44 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-03-05 18:56 How do I use text script containing SQL? Jeff S. <pgsqluser@yahoo.com>
2001-03-05 19:08 ` David Olbersen <dave@slickness.org>
2001-03-05 22:14 ` Mathijs Brands <mathijs@ilse.nl>
2001-03-05 19:10 ` clayton cottingham <drfrog@smartt.com>
2001-03-05 19:22 ` Andrew Perrin <andrew_perrin@unc.edu>
2001-03-06 01:44 ` Jie Liang <jliang@ipinc.com>
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