Re: [SQL] Copying a row within table

2006-03-14 Thread John DeSoi
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

Re: [SQL] Savepoint/Rollback in functions

2006-03-14 Thread Alvaro Herrera
Scott Petersen wrote: Hi, > Question 1: does pg/psql functions allow "SAVEPOINT/ROLLBACK" > functionality? (if so how?) Yes. However, you cannot use that syntax directly. You rather use it by establishing EXCEPTION clauses in BEGIN/END blocks. Upon entering any BEGIN/END block which has an

[SQL] Savepoint/Rollback in functions

2006-03-14 Thread Scott Petersen
I am running postgres 8.1.2 on both a windows and Linux platform. The primary method of managing business logic is through the use of functions. Our primary access to the database is by using PSQL (pg/psql). The problem that I am having is that we need to execute and implement "SAVEPOINT" an

Re: [SQL] how to get the size of array?

2006-03-14 Thread Andreas Kretschmer
Emi Lu <[EMAIL PROTECTED]> schrieb: > Hello, > > Is there a way that I can get the size of one array ? Yes: http://www.postgresql.org/docs/8.1/interactive/functions-array.html HTH, Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect.

[SQL] how to get the size of array?

2006-03-14 Thread Emi Lu
Hello, Is there a way that I can get the size of one array ? For example, create table test (id varchar[]); insert into test values('{}'); insert into test values('{1, 2, 3}'); I am looking for something like : select sizeOf(id) as size from test; so that I can get results like: size --

Re: [SQL] Copying a row within table

2006-03-14 Thread george young
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

Re: [SQL] connectby documentation

2006-03-14 Thread Achilleus Mantzios
O Jean-Paul Argudo έγραψε στις Mar 14, 2006 : > Daniel Caune a ιcrit : > > Wow, that was the quest for the Holy Grail! :-) > > Yes I understand. That kind of documentation for a > contrib-addon-whatever for PostgreSQL can be tricky sometimes to find.. > > > I just jump on that thread to place a

Re: [SQL] connectby documentation

2006-03-14 Thread Jean-Paul Argudo
Daniel Caune a écrit : > Wow, that was the quest for the Holy Grail! :-) Yes I understand. That kind of documentation for a contrib-addon-whatever for PostgreSQL can be tricky sometimes to find.. I just jump on that thread to place a reminder for all those wanting to implement trees in databases