On Wed, Sep 27, 2006 at 02:39:13PM +0300, Peter wrote:
> COPY wont work... my list of columns for insert is also dynamically
> built and will never cover all fields in table.
You don't have to include all columns for copy, just the fields you
copy into, the rest should get the default.
COPY tabl
On Sep 27, 2006, at 20:39 , Peter wrote:
Using COPY avoids this issue ofcourse, because there's a direct
link to the table. Similarly, as of 8.2 it will be possible to do:
INSERT INTO table (blah) VALUES (x,y,a),(f,d,g),(s,f,g), etc...
Which will also avoid the issue.
COPY wont work... my
Typecast eliminates the issue, you're right on that as well. However, my
problem is that those statements are dynamically generated on various
tables/columns, so typecasting would mean extracting target field type
and translating fieldtype code into SQL typename. Rather messy.
On Wed, Sep 27, 2006 at 01:05:56PM +0300, Peter wrote:
> Typecast eliminates the issue, you're right on that as well. However, my
> problem is that those statements are dynamically generated on various
> tables/columns, so typecasting would mean extracting target field type
> and translating fie
Martijn van Oosterhout wrote:
On Wed, Sep 27, 2006 at 12:14:44PM +0300, Peter wrote:
create table temp(a timestamptz);
insert into temp(a) select NULL; /* this passes */
insert into temp(a) select NULL union select NULL; /* fails:
ERROR: column "a" is of type timestamp with time
On Wed, Sep 27, 2006 at 12:14:44PM +0300, Peter wrote:
> create table temp(a timestamptz);
>
> insert into temp(a) select NULL; /* this passes */
>
> insert into temp(a) select NULL union select NULL; /* fails:
> ERROR: column "a" is of type timestamp with time zone but expression is
> of type t
create table temp(a timestamptz);
insert into temp(a) select NULL; /* this passes */
insert into temp(a) select NULL union select NULL; /* fails:
ERROR: column "a" is of type timestamp with time zone but expression is
of type text
*/
I need to insert hundreds of thousands of rows, and insert