pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Regarding COPY command from Postgres 8.2.0
5+ messages / 4 participants
[nested] [flat]

* Regarding COPY command from Postgres 8.2.0
@ 2007-09-14 10:21  soni de <soni.de@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: soni de @ 2007-09-14 10:21 UTC (permalink / raw)
  To: pgsql-performance

Hello,


In Postgres 7.2.4, COPY command is working fine even if tables have 6 fields
but we are copying only 5 fields from the file

But in Postgres 8.2.0, if table has 6 fields and we need to copy data for 5
fields only, then we need to specify the column names too in COPY command.

Is there any configurable option, so that without specifying column name in
COPY command we can copy records in table as happened in Postgres 7.2.4?



Please provide us some help regarding above query.



Thanks,

Soni

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Regarding COPY command from Postgres 8.2.0
@ 2007-09-14 12:03  Ansgar -59cobalt- Wiechers <lists@planetcobalt.net>
  parent: soni de <soni.de@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Ansgar -59cobalt- Wiechers @ 2007-09-14 12:03 UTC (permalink / raw)
  To: pgsql-performance

On 2007-09-14 soni de wrote:
> In Postgres 7.2.4, COPY command is working fine even if tables have 6
> fields but we are copying only 5 fields from the file
> 
> But in Postgres 8.2.0, if table has 6 fields and we need to copy data
> for 5 fields only, then we need to specify the column names too in
> COPY command.
> 
> Is there any configurable option, so that without specifying column
> name in COPY command we can copy records in table as happened in
> Postgres 7.2.4?

I don't know if it is possible, but even if it were I'd strongly
recommend against it, as you'd be relying on the order the columns were
created in. That's a rather bad idea IMHO. Why would you want to avoid
giving the names of the columns in the first place?

Regards
Ansgar Wiechers
-- 
"The Mac OS X kernel should never panic because, when it does, it
seriously inconveniences the user."
--http://developer.apple.com/technotes/tn2004/tn2118.html



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Regarding COPY command from Postgres 8.2.0
@ 2007-09-18 04:31  soni de <soni.de@gmail.com>
  parent: Ansgar -59cobalt- Wiechers <lists@planetcobalt.net>
  0 siblings, 2 replies; 5+ messages in thread

From: soni de @ 2007-09-18 04:31 UTC (permalink / raw)
  To: Ansgar -59cobalt- Wiechers <lists@planetcobalt.net>; +Cc: pgsql-performance

We have upgraded postgres from 7.2.4 to 8.2.0.
We have program which executes COPY command and our new database is changed
having some extra columns in some tables.
Because of this, COPY commands are failing.
So, we wanted the option to COPY the data without specifying column names.

Thanks,
Sonal


On 9/14/07, Ansgar -59cobalt- Wiechers <lists@planetcobalt.net> wrote:
>
> On 2007-09-14 soni de wrote:
> > In Postgres 7.2.4, COPY command is working fine even if tables have 6
> > fields but we are copying only 5 fields from the file
> >
> > But in Postgres 8.2.0, if table has 6 fields and we need to copy data
> > for 5 fields only, then we need to specify the column names too in
> > COPY command.
> >
> > Is there any configurable option, so that without specifying column
> > name in COPY command we can copy records in table as happened in
> > Postgres 7.2.4?
>
> I don't know if it is possible, but even if it were I'd strongly
> recommend against it, as you'd be relying on the order the columns were
> created in. That's a rather bad idea IMHO. Why would you want to avoid
> giving the names of the columns in the first place?
>
> Regards
> Ansgar Wiechers
> --
> "The Mac OS X kernel should never panic because, when it does, it
> seriously inconveniences the user."
> --http://developer.apple.com/technotes/tn2004/tn2118.html
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>       choose an index scan if your joining column's datatypes do not
>       match
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Regarding COPY command from Postgres 8.2.0
@ 2007-09-18 14:53  Evan Carroll <lists@evancarroll.com>
  parent: soni de <soni.de@gmail.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Evan Carroll @ 2007-09-18 14:53 UTC (permalink / raw)
  To: soni de <soni.de@gmail.com>; pgsql-performance

On 9/17/07, soni de <soni.de@gmail.com> wrote:
> We have upgraded postgres from 7.2.4 to 8.2.0.

This is one of the joys of 8.x over 7.2.x think of it like a different
sql product rather than an "upgrade." Its foundations are different.
7.4.x is still supported, and would have been a smoother upgrade for
you with less deprecations removed. To insert such a feature dependent
on column order without it being implied in the spec would be surely
be something deprecated quite quickly.

> We have program which executes COPY command and our new database is changed
> having some extra columns in some tables.
> Because of this, COPY commands are failing.
> So, we wanted the option to COPY the data without specifying column names.
>

The only way I can see a request, that allows for such bad-practice,
being approved would be if you were to use the '*' operator elegantly;
and, even then it would require you to update your code, only slightly
to a lesser degree than writing the column names.

Evan Carroll



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Regarding COPY command from Postgres 8.2.0
@ 2007-09-18 15:04  Scott Marlowe <scott.marlowe@gmail.com>
  parent: soni de <soni.de@gmail.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Scott Marlowe @ 2007-09-18 15:04 UTC (permalink / raw)
  To: soni de <soni.de@gmail.com>; +Cc: Ansgar -59cobalt- Wiechers <lists@planetcobalt.net>; pgsql-performance

On 9/17/07, soni de <soni.de@gmail.com> wrote:
> We have upgraded postgres from 7.2.4 to 8.2.0.
> We have program which executes COPY command and our new database is changed
> having some extra columns in some tables.
> Because of this, COPY commands are failing.
> So, we wanted the option to COPY the data without specifying column names.

Can't you just edit the import to have the newer 8.2.x syntax of

COPY table (field1, field2, field3, field4) FROM stdin;

???

And please tell me you aren't running 8.2.0, but 8.2.4 or now that it
just came out, 8.2.5.  Those minor point releases contain a lot of bug
fixes, and you're just asking for trouble by running a .0 release.



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2007-09-18 15:04 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-09-14 10:21 Regarding COPY command from Postgres 8.2.0 soni de <soni.de@gmail.com>
2007-09-14 12:03 ` Ansgar -59cobalt- Wiechers <lists@planetcobalt.net>
2007-09-18 04:31   ` soni de <soni.de@gmail.com>
2007-09-18 14:53     ` Evan Carroll <lists@evancarroll.com>
2007-09-18 15:04     ` Scott Marlowe <scott.marlowe@gmail.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