From: | "Rick Gigger" <rick(at)alpinenetworking(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Possible bug on insert |
Date: | 2003-10-06 20:00:06 |
Message-ID: | 01a101c38c44$70e0eec0$0700a8c0@trogdor |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I guess then I will switch to use COPY "tablename (fieldlist)" FROM. Will
this end up being faster anyway.
In case anyone was wondering here is a good example of how to do it in php
from:
http://us4.php.net/manual/en/function.pg-put-line.php
<?php
$conn = pg_pconnect("dbname=foo");
pg_query($conn, "create table bar (a int4, b char(16), d float8)");
pg_query($conn, "copy bar from stdin");
pg_put_line($conn, "3\thello world\t4.5\n");
pg_put_line($conn, "4\tgoodbye world\t7.11\n");
pg_put_line($conn, "\\.\n");
pg_end_copy($conn);
?>
thanks,
Rick Gigger
----- Original Message -----
From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Rick Gigger" <rick(at)alpinenetworking(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Sent: Monday, October 06, 2003 1:04 PM
Subject: Re: [GENERAL] Possible bug on insert
> "Rick Gigger" <rick(at)alpinenetworking(dot)com> writes:
> > insert into bugtest (a) select '1' union select '1'; -- this one fails
>
> > Is this a bug?
>
> No. It's unfortunate perhaps, but it's not a bug. The UNION forces us
> to make a decision about the output datatype of the UNION operation.
> In your other cases the chosen datatype is integer, which can later be
> cast to smallint for the insert, but in this case the chosen datatype is
> text, which is not implicitly castable to smallint.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Treat | 2003-10-06 20:06:12 | Re: PostgreSQL Beta4 Tag'd and Bundle'd ... |
Previous Message | Rick Gigger | 2003-10-06 19:55:38 | Re: Possible bug on insert |