Thread: concat for pgsql?

concat for pgsql?

From
"Thomas T. Thai"
Date:
i'm still porting my app from mysql to pgsql. i'm stuck on this one. in my
mysql app where i have a tree structure defined as:

01
0101
0102
...
ZZ01
ZZ02
ZZ0301
...etc


it's basically base 36

when i would move a node in the tree, i would do something like this in
mysql:

UPDATE tbl SET code =
CONCAT('NEWPREFIX',SUBSTRING(code,LENGTH('parent_code'))) WHERE \
code LIKE 'parent_code%';

so if i moved all the nodes under 01010201 to AA, it would UPDATE all the
paths starting with 01010201 with AA using CONCAT. i can't seem to find a
similar function in pgsql. ofcourse i could pull the results into an array
in php and loop through it to make the changes, and UPDATE them
individually back to pgsql, but that's a very slow process.




FOUND Re: concat for pgsql?

From
"Thomas T. Thai"
Date:
sorry it was the very first thing in functions-sting.htm manual. i guess i
was looking for the actual function name CONCAT.

string || string

On Fri, 26 Jan 2001, Thomas T. Thai wrote:

> Date: Fri, 26 Jan 2001 11:57:55 -0600 (CST)
> From: Thomas T. Thai <tom@minnesota.com>
> To: PostgreSQL General <pgsql-general@postgresql.org>
> Subject: concat for pgsql?
>
> i'm still porting my app from mysql to pgsql. i'm stuck on this one. in my
> mysql app where i have a tree structure defined as:
>
> 01
> 0101
> 0102
> ...
> ZZ01
> ZZ02
> ZZ0301
> ...etc
>
>
> it's basically base 36
>
> when i would move a node in the tree, i would do something like this in
> mysql:
>
> UPDATE tbl SET code =
> CONCAT('NEWPREFIX',SUBSTRING(code,LENGTH('parent_code'))) WHERE \
> code LIKE 'parent_code%';
>
> so if i moved all the nodes under 01010201 to AA, it would UPDATE all the
> paths starting with 01010201 with AA using CONCAT. i can't seem to find a
> similar function in pgsql. ofcourse i could pull the results into an array
> in php and loop through it to make the changes, and UPDATE them
> individually back to pgsql, but that's a very slow process.
>
>
>
>