Re: Questions about functionality - Mailing list pgsql-general

From Karl O. Pinc
Subject Re: Questions about functionality
Date
Msg-id 1107539977l.6303l.1l@mofo
Whole thread Raw
In response to Questions about functionality  ("Ignacio Colmenero" <ignacio.colmenero@micotan.com>)
Responses Re: Questions about functionality
Re: Questions about functionality
List 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@meme.com>
Free Software:  "You don't pay back, you pay forward."
                 -- Robert A. Heinlein



pgsql-general by date:

Previous
From: Marco Colombo
Date:
Subject: Re: Best Linux Distribution
Next
From: "Juan Casero (FL FLC)"
Date:
Subject: plpgsql function errors