On Wednesday 15 March 2006 03:11, John DeSoi wrote:
> On Mar 14, 2006, at 2:19 AM, Aarni Ruuhimäki wrote:
> > testing=# INSERT INTO foo (foo_1, foo_2, foo_3 ...) (SELECT foo_1,
> > foo_2,
> > foo_3 ... FROM message_table WHERE foo_id = 10);
> > INSERT 717286 1
> > testing=#
> >
> > Is there a fast
On Mar 14, 2006, at 2:19 AM, Aarni Ruuhimäki wrote:
testing=# INSERT INTO foo (foo_1, foo_2, foo_3 ...) (SELECT foo_1,
foo_2,
foo_3 ... FROM message_table WHERE foo_id = 10);
INSERT 717286 1
testing=#
Is there a fast way to copy all but not the PK column to a new row
within the
same table
Assuming the sequence in foo is named foo_seq, you could do:
-- You could also select multiple rows here, e.g. foo_id>10, if desired.
create temp table foo_tmp as select * from foo where foo_id=2;
alter table foo_tmp add column tmp_seq int default nextval('foo_seq');
-- foo_tmp now *shares* the se
Hi people,
testing=# INSERT INTO foo (SELECT * FROM foo WHERE foo_id = 2);
ERROR: duplicate key violates unique constraint "foo_pkey"
testing=#
testing=# INSERT INTO foo (foo_1, foo_2, foo_3 ...) (SELECT foo_1, foo_2,
foo_3 ... FROM message_table WHERE foo_id = 10);
INSERT 717286 1
testing=#
I