Aleksandr Furmanov wrote
> Thanks,
> However I am not just replicating data from 'a' to 'b', I provided
> simplified example, in reality table 'b' keeps data which are going to be
> merged into 'a', some rows will be updated, some added. There is some
> other work has to be done on 'b' before mergi
Thanks,
However I am not just replicating data from 'a' to 'b', I provided simplified
example, in reality table 'b' keeps data which are going to be merged into 'a',
some rows will be updated, some added. There is some other work has to be done
on 'b' before merging into 'a' and that work relies
If you're just replicating the data from table A into table B, why does it need
its own ID number? Wouldn't the table A ID suffice?
I'd recommend using the following:
CREATE TABLE b AS ( SELECT * FROM a );
This way, you only define the columns and insert the data once, then let
Postgres do the
Hello,
I want to insert new values into target table 'a' from source table 'b', and
then update table 'b' with ids from table 'a', somewhat like:
CREATE TABLE a(id SERIAL, name TEXT);
INSERT INTO a (name) VALUES('Jason');
INSERT INTO a (name) VALUES('Peter');
CREATE TABLE b(row_id serial, id INT
cool, thanks
On Tue, Oct 2, 2012 at 3:13 PM, Cédric Villemain wrote:
> **
>
> Le mardi 2 octobre 2012 15:01:08, Willy-Bas Loos a écrit :
>
> > Hi,
>
> > (postgres 9.1)
>
> > I was doing something like this in a plpgsql function, but i got a Syntax
>
> > Error.
>
> >
>
> > t_var:=(insert into tabl
Le mardi 2 octobre 2012 15:01:08, Willy-Bas Loos a écrit :
> Hi,
> (postgres 9.1)
> I was doing something like this in a plpgsql function, but i got a Syntax
> Error.
>
> t_var:=(insert into table1(field2) values ('x') returning field1);
>
> Is there no support for using RETURNING in insert, upda
Tirsdag 2. oktober 2012 15.01.08 skrev Willy-Bas Loos :
> Hi,
> (postgres 9.1)
> I was doing something like this in a plpgsql function, but i got a Syntax
> Error.
>
> t_var:=(insert into table1(field2) values ('x') returning field1);
>
> Is there no support for using RETURNING in insert, update
Hi,
(postgres 9.1)
I was doing something like this in a plpgsql function, but i got a Syntax
Error.
t_var:=(insert into table1(field2) values ('x') returning field1);
Is there no support for using RETURNING in insert, update, delete queries
to fill a variable in plpgsql?
Here's some code. Retur
On Sep 7, 2012, at 2:19 PM, David Johnston wrote:
>
> From: pgsql-general-ow...@postgresql.org
> [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Michael Sacket
> Sent: Friday, September 07, 2012 2:09 PM
> To: PG-General Mailing List
> Subject: [GENERAL] INSERT… RET
You can make function what returns integer and has input parametars as
other columns of the table:
INSERT INTO testing (category, name, fk_parent) (input parameters)
returning rid
Then SELECT rid as OriginalId, make_copy(other columns) as new_rid From
testing
Kind Regards,
Misa
On Friday, Septe
t; Best Regards,
> Dinesh
> manojadinesh.blogspot.com
>
>
> On Sat, Sep 8, 2012 at 12:49 AM, David Johnston wrote:
>
>
> From: pgsql-general-ow...@postgresql.org
> [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Michael Sacket
> Sent: Friday, September 07, 2012 2:
al-ow...@postgresql.org] *On Behalf Of *Michael Sacket
> *Sent:* Friday, September 07, 2012 2:09 PM
> *To:* PG-General Mailing List
> *Subject:* [GENERAL] INSERT… RETURNING for copying records
>
> ** **
>
> Good Afternoon,
>
> ** **
>
> I'm attempting to
From: pgsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Michael Sacket
Sent: Friday, September 07, 2012 2:09 PM
To: PG-General Mailing List
Subject: [GENERAL] INSERT. RETURNING for copying records
Good Afternoon,
I'm attempting to wr
Good Afternoon,
I'm attempting to write a function that will duplicate a few records, but the
catch is I need to have a mapping of the original pk to the new pk. I know I
can use the RETURNING clause to get the new ids... but how to map that to the
original ones is escaping me.
< Setup >
CRE
On 21 Jul 2010, at 11:35, pdov...@tiscali.it wrote:
>> Yes, Jan's right. You're effectively overriding the return values
>> with NULL.
>>
>> Although I think I know why you're doing it, because you want to
>> redirect the value to the child table so that it doesn't get inserted
>> into the pare
Hi Tom
Messaggio originale
Da: thombr...@gmail.com
Data: 21/07/2010 10.38
A: "Jan Otto"
Cc: "pdov...@tiscali.it", "pgsql-
gene...@postgresql.org"
Ogg: Re: [GENERAL] INSERT RETURNING and partitioning
On 21 July 2010 09:17, Jan Otto wrote:
> hi,
>
Hi Jan,
Messaggio originale
Da: as...@me.com
Data: 21/07/2010 10.17
A: "pdov...@tiscali.it"
Cc: "pgsql-general@postgresql.org"
Ogg: Re: [GENERAL] INSERT RETURNING and partitioning
hi,
On Jul 21, 2010, at 10:02, "pdov...@tiscali.it"
wrote:
> Hi,
&g
On 21 July 2010 09:17, Jan Otto wrote:
> hi,
>
> On Jul 21, 2010, at 10:02, "pdov...@tiscali.it" wrote:
>
>> Hi,
>> I'm testing the system with these two insert commands:
>>
>> 1) this command returns an empty result set:
>> insert into support.master (a) VALUES (2) RETURNING seq;
>>
>> 2) this c
hi,
On Jul 21, 2010, at 10:02, "pdov...@tiscali.it"
wrote:
Hi,
I'm testing the system with these two insert commands:
1) this command returns an empty result set:
insert into support.master (a) VALUES (2) RETURNING seq;
2) this command returns correctly the seq (serial) value into result
Hi,
I'm testing the system with these two insert commands:
1) this command returns an empty result set:
insert into support.master (a) VALUES (2) RETURNING seq;
2) this command returns correctly the seq (serial) value into result
set:
insert into support.partitionB (a) VALUES (2) RETURNING seq;
On 20 July 2010 14:42, pdov...@tiscali.it wrote:
> Hi all,
> I've noticed that an insert command with returning clause returns an
> empty result set if done on a master table. Instead the same insert
> with returning on partitioned tables works correctly.
>
> Do you know if it's a normal action? I
Hi all,
I've noticed that an insert command with returning clause returns an
empty result set if done on a master table. Instead the same insert
with returning on partitioned tables works correctly.
Do you know if it's a normal action? I'm doing something wrong?
The partitioning works correctly
On 26 Sep 2009, at 19:57, Tom Lane wrote:
I think you want INSERT ... RETURNING ... INTO some-plpgsql-variable;
regards, tom lane
On 26 Sep 2009, at 19:56, Adrian Klaver wrote:
See:
http://www.postgresql.org/docs/8.4/interactive/plpgsql-
statements.html#PLPGSQL-S
Iain Barnett writes:
> I've written a straightforward insert function, but using the
> RETURNING keyword for the first time. If I try running the test case
> I get the error:
> ERROR: query has no destination for result data
> CONTEXT: PL/pgSQL function "nonauth_users_insert_new_udf" line 7
On Saturday 26 September 2009 11:04:42 am Iain Barnett wrote:
> I've written a straightforward insert function, but using the
> RETURNING keyword for the first time. If I try running the test case
> I get the error:
>
> ERROR: query has no destination for result data
> CONTEXT: PL/pgSQL function
I've written a straightforward insert function, but using the
RETURNING keyword for the first time. If I try running the test case
I get the error:
ERROR: query has no destination for result data
CONTEXT: PL/pgSQL function "nonauth_users_insert_new_udf" line 7 at
SQL statement
I'm not s
On Mon, Jun 1, 2009 at 2:35 PM, Tom Lane wrote:
> Sava Chankov writes:
>> Is there a way to make RETURNING return all view columns?
>
> Something like
>
> CREATE RULE _insert AS ON INSERT TO j DO INSTEAD(
> INSERT INTO a (id,name) VALUES (NEW.id, NEW.name);
> INSERT INTO b (id,surname) VALUES (
Sava Chankov writes:
> Is there a way to make RETURNING return all view columns?
Something like
CREATE RULE _insert AS ON INSERT TO j DO INSTEAD(
INSERT INTO a (id,name) VALUES (NEW.id, NEW.name);
INSERT INTO b (id,surname) VALUES (NEW.id,NEW.surname)
RETURNING id, (SELECT name FROM a WH
I have a view that joins several tables and want to create unconditional
INSERT RETURNING rule for it. I succeeded by specifying the RETURNING clause
for the first INSERT in the rule, casting NULL for columns that are not
present in that table to the correct type:
CREATE TABLE a (id SERIAL PRIMARY
On Thu, Nov 6, 2008 at 8:49 AM, Rafal Pietrak <[EMAIL PROTECTED]> wrote:
> One comment I'd like to make as total lamer on the subject, is that the
> assumption on SELECT (that it's not firing triggers), could potentially
> be resolved by a *global* or "database" configuration option - once
> select
On Wed, 2008-11-05 at 14:38 -0500, Merlin Moncure wrote:
[]
> >
> >> It's more complicated than it looks (triggers).
> >
> > Could you give me pointers where I could get some more information on
[]
> matter, the system has several not-easily-removed assumptions that a
> SELECT command won
On Wed, Nov 5, 2008 at 11:20 AM, Rafal Pietrak <[EMAIL PROTECTED]> wrote:
> Hi,
>
> On Wed, 2008-11-05 at 10:34 -0500, Merlin Moncure wrote:
>> On Wed, Nov 5, 2008 at 2:41 AM, Rafal Pietrak <[EMAIL PROTECTED]> wrote:
>> > Hi Everybody,
> [...]
>> > I've just upgraded to v8.3.4 ... since eventually
Hi,
On Wed, 2008-11-05 at 10:34 -0500, Merlin Moncure wrote:
> On Wed, Nov 5, 2008 at 2:41 AM, Rafal Pietrak <[EMAIL PROTECTED]> wrote:
> > Hi Everybody,
[...]
> > I've just upgraded to v8.3.4 ... since eventually it does have
> > INSERT ... RETURNING extention to the SQL standard.
> >
> > The doc
On Wed, Nov 5, 2008 at 2:41 AM, Rafal Pietrak <[EMAIL PROTECTED]> wrote:
> Hi Everybody,
>
> Forgive my sarcasm below, but I just *adore* postgres for years, now. I
> hope it's all natural with this level of emotions to be deeply hurt when
> the object of attraction is (to quote HHTTG by Douglas Ad
Hi Everybody,
Forgive my sarcasm below, but I just *adore* postgres for years, now. I
hope it's all natural with this level of emotions to be deeply hurt when
the object of attraction is (to quote HHTTG by Douglas Adams): "
almost, but not quite entirely unlike tea".
I've just upgraded to v8
Hi.
It can be referred to from the page by which we were renewed.
http://npgsql.projects.postgresql.org/
I want it to be useful for you.
P.S)
[EMAIL PROTECTED] is the place of best discussion.
Regards,
Hiroshi Saito
- Original Message -
From: "Cesar Alvarez" <[EMAIL PROTECTED]>
Go
Good day every one .
Im trying to make and insert returning with the connector Npgsql, where
can i read more about the syntax of the insert string? or how to
configure the Npgsql.command class.
Regards Cesar Alvarez.
begin:vcard
fn:Cesar Alvarez
n:;Cesar Alvarez
title:Web Development Asesor a
On Sun, Oct 14, 2007 at 12:01:45AM -0600, Cesar Alvarez wrote:
> Hello
> im working in a proyect in ORACLE 10g and one of the things i like is
> using the INSERT RETURNING with the parameters, im not sure that i read
> about postgres 8.2 suporting this feature... if its true where can i
> read m
Hello
im working in a proyect in ORACLE 10g and one of the things i like is
using the INSERT RETURNING with the parameters, im not sure that i read
about postgres 8.2 suporting this feature... if its true where can i
read more about it.
regards Cesar Alvarez.
begin:vcard
fn:Cesar Alvarez
n:;Ce
Alvaro Herrera <[EMAIL PROTECTED]> writes:
> Tom Allison escribió:
>> insert into table(string) values(('one'),('two'),('three')) returning
>> idx;
>>
>> I realize that this is an extension to standard SQL but it sure would
>> save me a lot.
> You are wrong -- you can do it, but it is not an
Tom Allison escribió:
> Holy Crud!
> you mean to tell me I can replace:
>
> insert into table(string) values(('one'),('two'),('three'));
> select idx from table where string in ('one','two','three');
>
> with
>
> insert into table(string) values(('one'),('two'),('three')) returning
> idx;
>
Holy Crud!
you mean to tell me I can replace:
insert into table(string) values(('one'),('two'),('three'));
select idx from table where string in ('one','two','three');
Yes.
A smart ORM library should, when you create a new database object from
form values, use INSERT RETURNING to
On Jun 12, 2007, at 11:40 AM, Vincenzo Romano wrote:
On Tuesday 12 June 2007 16:35:05 Martijn van Oosterhout wrote:
On Tue, Jun 12, 2007 at 04:18:32PM +0200, Vincenzo Romano wrote:
Well, at least on v8.2.4 I cannot return count(*), that is the
number of lines actually inserted into the table
On Jun 12, 2007, at 10:18 AM, Vincenzo Romano wrote:
Hi all.
I'm trying to use this wonderful feature (thanks to anyone who
suggested/committed/implemented it).
According to the documentation:
(http://www.postgresql.org/docs/8.2/interactive/sql-insert.html)
"The optional RETURNING clause cau
On Tuesday 12 June 2007 18:26:35 Tom Lane wrote:
> Vincenzo Romano <[EMAIL PROTECTED]> writes:
> > Second, I'm not using nested statements, but rather a plain
> > INSERT ... RETURNING COUNT(*) INTO var (it's inside a PL/PgSQL
> > function body). It should not need any GROUP BY as the query is
> > p
Vincenzo Romano <[EMAIL PROTECTED]> writes:
> Second, I'm not using nested statements, but rather a plain
> INSERT ... RETURNING COUNT(*) INTO var (it's inside a PL/PgSQL
> function body). It should not need any GROUP BY as the query is
> plain.
> Maybe the solution is somewhere in between what yo
Vincenzo Romano <[EMAIL PROTECTED]> writes:
> Well, at least on v8.2.4 I cannot return count(*), that is the
> number of lines actually inserted into the table. Nor I can return
> any aggregate function of them.
> Am I doing anything wrong or is there some missing sentence in the
> documentation?
On Tuesday 12 June 2007 16:35:05 Martijn van Oosterhout wrote:
> On Tue, Jun 12, 2007 at 04:18:32PM +0200, Vincenzo Romano wrote:
> > Well, at least on v8.2.4 I cannot return count(*), that is the
> > number of lines actually inserted into the table. Nor I can
> > return any aggregate function of t
On Tue, Jun 12, 2007 at 04:18:32PM +0200, Vincenzo Romano wrote:
> Well, at least on v8.2.4 I cannot return count(*), that is the
> number of lines actually inserted into the table. Nor I can return
> any aggregate function of them.
I don't think anybody considered the possibility of using an aggr
Hi all.
I'm trying to use this wonderful feature (thanks to anyone who
suggested/committed/implemented it).
According to the documentation:
(http://www.postgresql.org/docs/8.2/interactive/sql-insert.html)
"The optional RETURNING clause causes INSERT to compute and return
value(s) based on each ro
Hello,
I'm attempting to convert a big table into smaller tables; I currently
do a lot of INSERT .. RETURNING calls on the big table, which works
perfectly.
To convert the table into smaller tables, I have set up a test case of
3 tables, based on a 'CHECK ( hashtext(field) % 2 ) = -1' (or 0 or 1
Hello,
I'm attempting to convert a big table into smaller tables; I currently
do a lot of INSERT .. RETURNING calls on the big table, which works
perfectly.
To convert the table into smaller tables, I have set up a test case of
3 tables, based on a 'CHECK ( hashtext(field) % 2 ) = -1' (or 0 or 1
Hello,
I'm attempting to convert a big table into smaller tables; I currently
do a lot of INSERT .. RETURNING calls on the big table, which works
perfectly.
To convert the table into smaller tables, I have set up a test case of
3 tables, based on a 'CHECK ( hashtext(field) % 2 ) = -1' (or 0 or 1
Just wanted to add that PHP has a GETLASTOID function that will work
(after an insert) even if you don't use sequences/serials.
--
Jean-Christophe Boggio
[EMAIL PROTECTED]
Independant Consultant and Developer
Delphi, Linux, Perl, PostgreSQL
---(end of broadcast)---
Title: RE: [GENERAL] INSERT ... RETURNING as Oracle
And using MAX is also horrifically slow once you start having any significant volumes of data.
Why not write a function to add the info, which selects from a sequence, inserts the new row using the sequence number, and then returns the
"Sipos Andras" wrote: >create table basket (
> id serial NOT NULL PRIMARY KEY,
> timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
>);
>
>How can I make a one step insert into the table and get values of 'ID' ?
>I am trying to find a similar solution as in the oracle's INSE
Sipos Andras writes:
> create table basket (
> id serial NOT NULL PRIMARY KEY,
> timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
> );
>
> How can I make a one step insert into the table and get values of 'ID' ?
> I am trying to find a similar solution as in the oracle's INSERT ...
Hi,
Sample table:
create table basket (
id serial NOT NULL PRIMARY KEY,
timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);
How can I make a one step insert into the table and get values of 'ID' ?
I am trying to find a similar solution as in the oracle's INSERT ...
RETURNING.
If
58 matches
Mail list logo