Re: [HACKERS] COPY commands could use an enhancement.

2001-04-30 Thread Tom Lane

Philip Warner <[EMAIL PROTECTED]> writes:
> Do you have a alternate suggestion as to how to solve the problems it has
> backing up the regression DB?

One possibility is to fix ALTER TABLE ADD COLUMN to maintain the same
column ordering in parents and children.

COPY with specified columns may in fact be the best way to deal with
that particular issue, if pg_dump is all we care about fixing.  However
there are a bunch of things that have a problem with it, not only
pg_dump.  See thread over in committers about functions and inheritance.

regards, tom lane

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])



Re: [HACKERS] COPY commands could use an enhancement.

2001-04-30 Thread Philip Warner

At 11:36 30/04/01 -0400, Tom Lane wrote:
>
>COPY is designed as a simple, fast, reliable,
>low-overhead data transfer mechanism for backup and restore.  The more
>warts we add to it, the less well it will serve that purpose.
>

Do you have a alternate suggestion as to how to solve the problems it has
backing up the regression DB?



Philip Warner| __---_
Albatross Consulting Pty. Ltd.   |/   -  \
(A.B.N. 75 008 659 498)  |  /(@)   __---_
Tel: (+61) 0500 83 82 81 | _  \
Fax: (+61) 0500 83 82 82 | ___ |
Http://www.rhyme.com.au  |/   \|
 |----
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



Re: [HACKERS] COPY commands could use an enhancement.

2001-04-30 Thread Fernando Nasser

Karen saw me importing data into a database using pgaccess.

Again, this could be useful to someone that it is not a "superuser". 
But only superusers can use pgaccess.  What a shame :-(

Fernando

P.S.: pgaccess has a much more limited import facility - only text files
and you can only change the delimiter.  But it can be expanded.


Tom Lane wrote:
> 
> Alfred Perlstein <[EMAIL PROTECTED]> writes:
> > It would be very helpful if the COPY command could be expanded
> > in order to provide positional parameters.
> 
> I think it's a bad idea to try to expand COPY into a full-tilt data
> import/conversion utility, which is the direction that this sort of
> suggestion is headed in.  COPY is designed as a simple, fast, reliable,
> low-overhead data transfer mechanism for backup and restore.  The more
> warts we add to it, the less well it will serve that purpose.
> 
> Example: if we allow selective column import, what do we do with missing
> columns?  Must COPY now be able to handle insertion of default-value
> expressions?
> 
> I think it'd be better to put effort into an external data translation
> utility that can deal with column selection, data reformatting, CR/LF
> conversion, and all those other silly little issues that come up when
> you need to move data from one DBMS to another.  Sure, we could make
> the backend do some of this stuff, but it'd be more maintainable as a
> separate program ... IMHO anyway.  I think that pgaccess and pgadmin
> already have some capability in this line, BTW.
> 
> regards, tom lane
> 
> ---(end of broadcast)---
> TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

-- 
Fernando Nasser
Red Hat Canada Ltd. E-Mail:  [EMAIL PROTECTED]
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



Re: [HACKERS] COPY commands could use an enhancement.

2001-04-30 Thread Bruce Momjian

> Alfred Perlstein <[EMAIL PROTECTED]> writes:
> > It would be very helpful if the COPY command could be expanded
> > in order to provide positional parameters.
> 
> I think it's a bad idea to try to expand COPY into a full-tilt data
> import/conversion utility, which is the direction that this sort of
> suggestion is headed in.  COPY is designed as a simple, fast, reliable,
> low-overhead data transfer mechanism for backup and restore.  The more
> warts we add to it, the less well it will serve that purpose.

What is really cool is Informix's UNLOAD/LOAD commands.  It combines
COPY with SELECT/INSERT:

UNLOAD TO '/tmp/x'
SELECT * FROM tab

and LOAD is similar:

LOAD FROM '/tmp/x'
INSERT INTO TAB

This leverages SELECT and INSERT's column and WHERE capabilities to do
almost anything you want with flat files.  I think it is superior to our
COPY.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



Re: [HACKERS] COPY commands could use an enhancement.

2001-04-30 Thread Alfred Perlstein

* Tom Lane <[EMAIL PROTECTED]> [010430 08:37] wrote:
> Alfred Perlstein <[EMAIL PROTECTED]> writes:
> > It would be very helpful if the COPY command could be expanded
> > in order to provide positional parameters.
> 
> I think it's a bad idea to try to expand COPY into a full-tilt data
> import/conversion utility, which is the direction that this sort of
> suggestion is headed in.  COPY is designed as a simple, fast, reliable,
> low-overhead data transfer mechanism for backup and restore.  The more
> warts we add to it, the less well it will serve that purpose.

Honestly it would be hard for COPY to be any more less serving of
people's needs, it really makes sense for it to be able to parse
positional paramters for both speed and correctness.

> Example: if we allow selective column import, what do we do with missing
> columns?

What is already done, if you initiate a copy into a 5 column table
using only 4 columns of copy data the fifth is left empty.

> Must COPY now be able to handle insertion of default-value
> expressions?

No, copy should be what it is simple but at the same time useful
enough for bulk transfer without painful contortions and fear
of modifying tables.

-- 
-Alfred Perlstein - [[EMAIL PROTECTED]]
Represent yourself, show up at BABUG http://www.babug.org/

---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl



Re: [HACKERS] COPY commands could use an enhancement.

2001-04-30 Thread Tom Lane

Alfred Perlstein <[EMAIL PROTECTED]> writes:
> It would be very helpful if the COPY command could be expanded
> in order to provide positional parameters.

I think it's a bad idea to try to expand COPY into a full-tilt data
import/conversion utility, which is the direction that this sort of
suggestion is headed in.  COPY is designed as a simple, fast, reliable,
low-overhead data transfer mechanism for backup and restore.  The more
warts we add to it, the less well it will serve that purpose.

Example: if we allow selective column import, what do we do with missing
columns?  Must COPY now be able to handle insertion of default-value
expressions?

I think it'd be better to put effort into an external data translation
utility that can deal with column selection, data reformatting, CR/LF
conversion, and all those other silly little issues that come up when
you need to move data from one DBMS to another.  Sure, we could make
the backend do some of this stuff, but it'd be more maintainable as a
separate program ... IMHO anyway.  I think that pgaccess and pgadmin
already have some capability in this line, BTW.

regards, tom lane

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



[HACKERS] COPY commands could use an enhancement.

2001-04-30 Thread Alfred Perlstein

It would be very helpful if the COPY command could be expanded
in order to provide positional parameters.

I noticed that it didn't a while back and it can really hurt
someone when they happen to try to use pg_dump to move data
from one database to another database and they happened to
create the feilds in the tables in different orders.

Basically:
COPY "webmaster" FROM stdin;

could become:
COPY "webmaster" FIELDS "id", "name", "ssn" FROM stdin;

this way when sourcing it would know where to place the
feilds.

-- 
-Alfred Perlstein - [[EMAIL PROTECTED]]
Daemon News Magazine in your snail-mail! http://magazine.daemonnews.org/

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly