Re: [INSERT]Return a value
Re: [INSERT]Return a value
От:
"A. Kretschmer" <andreas.kretschmer@schollglas.com>
Дата:
am Fri, dem 07.11.2008, um 11:21:05 -0200 mailte Leví Teodoro da Silva folgendes: > Hi guys, > > I was looking for something like the follow but i dont get ... > > I want to do two inserts. In my first insert i want that the query returns a > result for me and in the second, i want that the postgres just insert the > values in my table. IIRC, you can't use the RETURNING value for a neu INSERT, it is a TODO for the next release. Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
Re: [INSERT]Return a value
От:
Andreas Kretschmer <akretschmer@spamfence.net>
Дата:
Leví Teodoro da Silva schrieb: > Andreas, > > I dont want to insert the values that the first insert returned in the second > insert, i just want to receive the return value from the first query and after > i want to execute a different query not related with the first. Is it not Sorry, i misunderstood the question. Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) "If I was god, I would recompile penguin with --enable-fly." (unknown) Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
Re: [INSERT]Return a value
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"=?ISO-8859-1?Q?Lev=ED_Teodoro_da_Silva?=" writes:
> INSERT INTO "Login"(
> "CPF", "password", status, "idSeller")
> VALUES ('108', '12345', 'ok', '2555') RETURNING "CPF" INTO STRICT teste;
It looks like you are trying to do this at the SQL level, in which case
you should leave off the INTO bit.
regards, tom lane
Re: [INSERT]Return a value
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"=?ISO-8859-1?Q?Lev=ED_Teodoro_da_Silva?=" writes:
> When try to execute it on pgadmin :
> BEGIN;
> INSERT INTO "Login"(
> "CPF", "password", status, "idSeller")
> VALUES ('1', '1', 'ok', '1') RETURNING "CPF";
> COMMIT;
> I got the follow :
> *Query result with 1 rows discarded*
Is that a current version of pgAdmin? If so, you need to complain to
the pgAdmin folks. If it's not current, it might not know about
RETURNING.
regards, tom lane
[INSERT]Return a value
От:
"Leví Teodoro da Silva" <tlevisilva@gmail.com>
Дата:
Hi guys,
I was looking for something like the follow but i dont get ...
I want to do two inserts. In my first insert i want that the query returns a result for me and in the second, i want that the postgres just insert the values in my table.
I thought the following :
BEGIN;
INSERT INTO "Login"(
"CPF", "password", status, "idSeller")
VALUES ('108', '12345', 'ok', '2555') RETURNING "CPF" INTO STRICT teste;
INSERT INTO "Login"(
"CPF", "password", status, "idSeller")
VALUES ('109', '12345', 'ok', '2559');
COMMIT;
It's execute the inserts but i dont receive the CPF value. If i put the first insert in a simple query, without BEGIN and COMMIT, it works fine.
How can i solve this problem !?
Regards,
Thanks,
Leví
I was looking for something like the follow but i dont get ...
I want to do two inserts. In my first insert i want that the query returns a result for me and in the second, i want that the postgres just insert the values in my table.
I thought the following :
BEGIN;
INSERT INTO "Login"(
"CPF", "password", status, "idSeller")
VALUES ('108', '12345', 'ok', '2555') RETURNING "CPF" INTO STRICT teste;
INSERT INTO "Login"(
"CPF", "password", status, "idSeller")
VALUES ('109', '12345', 'ok', '2559');
COMMIT;
It's execute the inserts but i dont receive the CPF value. If i put the first insert in a simple query, without BEGIN and COMMIT, it works fine.
How can i solve this problem !?
Regards,
Thanks,
Leví
Re: [INSERT]Return a value
От:
"Leví Teodoro da Silva" <tlevisilva@gmail.com>
Дата:
Andreas,
I dont want to insert the values that the first insert returned in the second insert, i just want to receive the return value from the first query and after i want to execute a different query not related with the first. Is it not possible !?
Thanks,
Leví
I dont want to insert the values that the first insert returned in the second insert, i just want to receive the return value from the first query and after i want to execute a different query not related with the first. Is it not possible !?
Thanks,
Leví
2008/11/7 A. Kretschmer <andreas.kretschmer@schollglas.com>
am Fri, dem 07.11.2008, um 11:21:05 -0200 mailte Leví Teodoro da Silva folgendes:> Hi guys,IIRC, you can't use the RETURNING value for a neu INSERT, it is a TODO
>
> I was looking for something like the follow but i dont get ...
>
> I want to do two inserts. In my first insert i want that the query returns a
> result for me and in the second, i want that the postgres just insert the
> values in my table.
for the next release.
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice
Re: [INSERT]Return a value
От:
"Leví Teodoro da Silva" <tlevisilva@gmail.com>
Дата:
When try to execute it on pgadmin :
BEGIN;
INSERT INTO "Login"(
"CPF", "password", status, "idSeller")
VALUES ('1', '1', 'ok', '1') RETURNING "CPF";
COMMIT;
I got the follow :
Query result with 1 rows discarded
Query returned successfully with no result in 0 ms.
But i dont want discard the result =/
Thanks,
Leví
BEGIN;
INSERT INTO "Login"(
"CPF", "password", status, "idSeller")
VALUES ('1', '1', 'ok', '1') RETURNING "CPF";
COMMIT;
I got the follow :
Query result with 1 rows discarded
Query returned successfully with no result in 0 ms.
But i dont want discard the result =/
Thanks,
Leví
2008/11/7 Tom Lane <tgl@sss.pgh.pa.us>
"Leví Teodoro da Silva" <tlevisilva@gmail.com> writes:It looks like you are trying to do this at the SQL level, in which case
> INSERT INTO "Login"(
> "CPF", "password", status, "idSeller")
> VALUES ('108', '12345', 'ok', '2555') RETURNING "CPF" INTO STRICT teste;
you should leave off the INTO bit.
regards, tom lane