Search Postgresql Archives

Re: query ... returned 4 columns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorin Schwimmer <sxn02@xxxxxxxxx> writes:
> Having the same structure, I put
> INSERT INTO archive.expected_stuff VALUES(o);
> but it doesn't work. Instead, I had to rewrite as
> INSERT ... VALUES (o.source,o.warehouse...);

Of course.  The former command implies that you are inserting a
composite value into a single composite-type column of expected_stuff,
which you are not.

The right way to express this IMHO is
	INSERT INTO archive.expected_stuff VALUES(o.*);
which should expand into the longhand notation "o.source,o.warehouse..."
in the same way that "SELECT o.* FROM ..." would do.  This does actually
work in 8.2 (and maybe 8.1, I forget).  In older releases you gotta
write it out longhand :-(

			regards, tom lane


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux