Function to ADD a value into each column of real[]

From: orehon <lucascarvalho(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Function to ADD a value into each column of real[]
Date: 2007-07-10 19:38:05
Message-ID: 1184096285.753327.167320@k79g2000hse.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,
if I have this table:
CREATE TABLE teste (
id integer,
picos real[],
);

and insert this values:
INSERT INTO teste VALUES(1, '{{1,2,3},{1,2,3},{1,2,3},{1,2,3},
{1,2,3}}');
INSERT INTO teste VALUES(2, '{{1,2,3},{1,2,3},{1,2,3},{1,2,3},{1,2,3},
{1,2,3},{1,2,3}}');
INSERT INTO teste VALUES(3, '{{1,2,3},{1,2,3},{1,2,3},{1,2,3},{1,2,3},
{1,2,3},{1,2,3},{1,2,3}}');
INSERT INTO teste VALUES(4, '{{1,2,3},{1,2,3},{1,2,3}}');

I need to write a function to return all the record of this table and
add a 0 in the begin of each array.
Ex.:

1, {{0,1,2,3},{0,1,2,3},{0,1,2,3},{0,1,2,3},{0,1,2,3}}
.............

How can I do that?
Any idea?!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jasbinder Singh Bali 2007-07-10 19:41:27 Implementing 2 different transactions in a PL/Perl function
Previous Message AlJeux 2007-07-10 19:36:14 Re: vacuumdb: PANIC: corrupted item pointer