Re: Questions about functionality

From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: Ignacio Colmenero <ignacio(dot)colmenero(at)micotan(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Questions about functionality
Date: 2005-02-04 17:59:37
Message-ID: 1107539977l.6303l.1l@mofo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On 02/04/2005 10:06:49 AM, Ignacio Colmenero wrote:
> Hello.
>
> I have been in this list for a very short period of time so, if my
> questions
> have been answered before, please tell me and I will browse again in
> the
> archives.
>
> 1. Is there anything in Postgre or third-party solutions similar to
> Oracle's
> SQL Loader, to upload a flat file into a table, according to certain
> rules?
> Any solutions you have tried before to solve this issue?

I don't know what you mean by "according to certain rules", but see
the SQL COPY command or the psql \copy command (client apps
section of the documentation). You can always
pre-process your files with awk or whatnot. I've done a bunch of
shell scripting to produce INSERT statements and fed them
to psql.

>
> 2. What are the nuts and bolts to run a SQL script from a batch file?
> I have
> browsed the documentation and I haven't seen anything clear.

psql -d database < /path/to/sql-script

It's a Unix thing, although I believe DOS will do this too.

In Unix you could put
#!/usr/bin/psql -d database
as the first line (and first character) of your sql script and then
make the file executable.

> 3. Can I store more than one polygon in a polygon datatype field,
> like
> ((x1,y1),(x2,y2),.),((x10,y10),(x11,y11),.) or I have to install
> PostGIS?

There are array data types, but I have not used them. I imagine
you could make an array of polygons.

> 4. Can I query an object in another database, like in Oracle's
> dblink?

I'm no expert. I don't believe so. You can query across scheams
in the same database but not across databases. You could do
something (anything!) by writing an external function in C or
whatever, but I couldn't say how much work that would take.

Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2005-02-04 18:01:16 Re: Questions about functionality
Previous Message Martijn van Oosterhout 2005-02-04 17:56:37 Re: Duration between two timestamps