Re: [GENERAL] Concatenate table name in Pl/Pgsql

2013-06-26 Thread Adarsh Sharma
Able to fix but still new error :( test=# CREATE OR REPLACE FUNCTION tmp_trigger_function() test-# RETURNS TRIGGER AS $$ test$# DECLARE test$# stmt text; test$# abc varchar; test$# BEGIN test$# select to_char(NEW.a::timestamp,'mmdd') into abc ; test$# stmt := 'insert into tmp'||abc|| '

Re: [GENERAL] Concatenate table name in Pl/Pgsql

2013-06-26 Thread Adarsh Sharma
Final Fix : execute 'insert into tmp'||abc|| ' select $1.*' using new; Thanks On Wed, Jun 26, 2013 at 12:18 PM, Adarsh Sharma eddy.ada...@gmail.comwrote: Able to fix but still new error :( test=# CREATE OR REPLACE FUNCTION tmp_trigger_function() test-# RETURNS TRIGGER AS $$ test$#

[GENERAL] Concatenate table name in Pl/Pgsql

2013-06-25 Thread Adarsh Sharma
Hi , Today i m creating a function that includes dynamic concatenation of a partitioned table name as below :- test=# CREATE OR REPLACE FUNCTION tmp_trigger_function() test-# RETURNS TRIGGER AS $$ test$# DECLARE test$# tbl_name text; test$# abc varchar; test$# BEGIN test$# tbl_name := 'tmp';

Re: [GENERAL] Concatenate table name in Pl/Pgsql

2013-06-25 Thread Adarsh Sharma
EXECUTE 'insert into tmp'||abc|| 'values ( NEW.* )'; This works :)

Re: [GENERAL] Concatenate table name in Pl/Pgsql

2013-06-25 Thread Ian Lawrence Barwick
2013/6/26 Adarsh Sharma eddy.ada...@gmail.com: Hi , Today i m creating a function that includes dynamic concatenation of a partitioned table name as below :- test=# CREATE OR REPLACE FUNCTION tmp_trigger_function() test-# RETURNS TRIGGER AS $$ test$# DECLARE test$# tbl_name text; test$#

Re: [GENERAL] Concatenate table name in Pl/Pgsql

2013-06-25 Thread Adarsh Sharma
Thanks Ian for such a quick response. But my NEW.* will be 10-15 columns row. test=# CREATE OR REPLACE FUNCTION tmp_trigger_function() test-# RETURNS TRIGGER AS $$ test$# DECLARE test$# stmt text; test$# abc varchar; test$# BEGIN test$# select to_char(NEW.a::timestamp,'mmdd') into abc ;

Re: [GENERAL] Concatenate table name in Pl/Pgsql

2013-06-25 Thread Ian Lawrence Barwick
Thanks On Wed, Jun 26, 2013 at 10:52 AM, Ian Lawrence Barwick barw...@gmail.com wrote: 2013/6/26 Adarsh Sharma eddy.ada...@gmail.com: Hi , Today i m creating a function that includes dynamic concatenation of a partitioned table name as below :- test=# CREATE OR REPLACE FUNCTION

Re: [GENERAL] Concatenate table name in Pl/Pgsql

2013-06-25 Thread Adarsh Sharma
Passing each column seems not good because if column additon/deletion happens in future , we also need to change function as well. I think below will work :- test=# CREATE OR REPLACE FUNCTION tmp_trigger_function() test-# RETURNS TRIGGER AS $$ test$# DECLARE test$# abc varchar; test$# BEGIN

[GENERAL] Concatenate

2010-03-24 Thread Frank jansen
Hi, can you help me with this tricky concat i have? I have a function with an execute statement, one line of it doing an md5 hash of some concatenated xml paths with values. I cannot get this one work, postgres is always complaing about some things, like: functions and operators can take at

Re: [GENERAL] Concatenate

2010-03-24 Thread Albe Laurenz
Frank jansen wrote: can you help me with this tricky concat i have? I have a function with an execute statement, one line of it doing an md5 hash of some concatenated xml paths with values. I cannot get this one work, postgres is always complaing about some things, like: functions and

Re: [GENERAL] Concatenate

2010-03-24 Thread Merlin Moncure
On Wed, Mar 24, 2010 at 6:22 AM, Frank jansen jan...@fumarium.de wrote: Hi, can you help me with this tricky concat i have? I have a function with an execute statement, one line of it doing an md5 hash of some concatenated xml paths with values. I cannot get this one work, postgres is

Re: [GENERAL] Concatenate [solved]

2010-03-24 Thread Frank jansen
Am 24.03.2010 14:41, schrieb Merlin Moncure: On Wed, Mar 24, 2010 at 6:22 AM, Frank jansenjan...@fumarium.de wrote: Hi, can you help me with this tricky concat i have? I have a function with an execute statement, one line of it doing an md5 hash of some concatenated xml paths with

[GENERAL] concatenate and use as field

2009-03-29 Thread Alain Roger
Hi, i have a character varying variable and i concatenate with some other variable, using the '||' operator. the result of this concatenation should be the name of a column in my table. however i don't know how to tell that this new concatenated string is a column name. how to do it ? thanks.

[GENERAL] Concatenate two queries - how?

2007-10-24 Thread Stefan Schwarzer
Hi there, I have two queries, which I would like to bring together to form one result. The first query is a simple SELECT on a table of national statistics. SELECT COALESCE(c.name, ), year_start AS year, value FROM fish_catch AS d LEFT JOIN

Re: [GENERAL] Concatenate two queries - how?

2007-10-24 Thread A. Kretschmer
am Wed, dem 24.10.2007, um 15:08:51 +0200 mailte Stefan Schwarzer folgendes: Now, I want to enable queries which display national as well as regional values. I could probably work with independent queries, but I think it would be cleaner and more efficient to get everything into a

Re: [GENERAL] Concatenate two queries - how?

2007-10-24 Thread Gauthier, Dave
Use union ??? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stefan Schwarzer Sent: Wednesday, October 24, 2007 9:09 AM To: pgsql-general@postgresql.org Subject: [GENERAL] Concatenate two queries - how? Hi there, I have two queries, which I would like

Re: [GENERAL] Concatenate two queries - how?

2007-10-24 Thread Stanislav Raskin
Gesendet: Mittwoch, 24. Oktober 2007 15:09 An: pgsql-general@postgresql.org Betreff: [GENERAL] Concatenate two queries - how? Hi there, I have two queries, which I would like to bring together to form one result. The first query is a simple SELECT on a table of national statistics. SELECT

Re: [GENERAL] Concatenate two queries - how?

2007-10-24 Thread Harald Fuchs
In article [EMAIL PROTECTED], A. Kretschmer [EMAIL PROTECTED] writes: am Wed, dem 24.10.2007, um 15:08:51 +0200 mailte Stefan Schwarzer folgendes: Now, I want to enable queries which display national as well as regional values. I could probably work with independent queries, but I think

Re: [GENERAL] Concatenate performance question

2006-12-06 Thread Michael Guyver
On 03/12/06, Tom Lane [EMAIL PROTECTED] wrote: Michael Guyver [EMAIL PROTECTED] writes: ... Running the array_append version is faster by at least one order of magnitude in these examples. Really? I see only about a 50% advantage (155 msec vs 105 msec) in both 8.1 and 8.2. What PG version

Re: [GENERAL] Concatenate performance question

2006-12-03 Thread Michael Guyver
Gents, At risk of answering my own question to spur someone actually to share their thoughts on this topic, I thought I'd provide a quick look at the performance of the alternatives: either using the || operator, or the array_append method. -- SELECT * FROM test_v_01(); -- SELECT * FROM

Re: [GENERAL] Concatenate performance question

2006-12-03 Thread Tom Lane
Michael Guyver [EMAIL PROTECTED] writes: ... Running the array_append version is faster by at least one order of magnitude in these examples. Really? I see only about a 50% advantage (155 msec vs 105 msec) in both 8.1 and 8.2. What PG version are you running? What database encoding are you

Re: [GENERAL] Concatenate performance question

2006-12-03 Thread Tom Lane
Michael Guyver [EMAIL PROTECTED] writes: CREATE OR REPLACE FUNCTION test_v_01() RETURNS VARCHAR AS $$ DECLARE buffer varchar; i int4; BEGIN buffer := 'the quick brown fox jumps over the lazy dog'; FOR i IN 1..1000 LOOP buffer := buffer || 'the quick

[GENERAL] Concatenate performance question

2006-11-29 Thread Michael Guyver
Hi there, I've got a rather large PL/pgSQL function which returns a varchar (though it could be text, char or blob, I'm not fussy) containing JSON information (where JSON is Javascript Object Notation). The middle tier of the app does pretty much sweet FA except pass this straight back to the

Re: [GENERAL] Concatenate WAL contents

2006-05-17 Thread Houssais Hugues
is not so important than the content exanged and the size of databases. Hugues -Message d'origine- De : Jim C. Nasby [mailto:[EMAIL PROTECTED] Envoyé : mardi 16 mai 2006 00:04 À : Houssais Hugues Cc : pgsql-general@postgresql.org Objet : Re: [GENERAL] Concatenate WAL contents On Wed, May

Re: [GENERAL] Concatenate WAL contents

2006-05-15 Thread Jim C. Nasby
On Wed, May 10, 2006 at 11:55:49AM +0200, Houssais Hugues wrote: Hi, In order to unify many distant Postgres databases, we decided to use WAL archiving. The idea is to concatenate a distant WAL archive at the beginning of a local WAL archive before launching PITR restore. Does anyone know

[GENERAL] Concatenate WAL contents

2006-05-12 Thread Houssais Hugues
Hi, In order to unify many distant Postgres databases, we decided to use WAL archiving. The idea is to concatenate a distant WAL archive at the beginning of a local WAL archive before launching PITR restore. Does anyone know how to concatenate WAL contents, i.e. decode and encode WAL

Re: [GENERAL] concatenate text

2005-09-05 Thread Tino Wildenhain
Am Montag, den 05.09.2005, 03:00 +0300 schrieb Sterpu Victor: Can I do something like this? SELECT sum(name) FROM table; Where name is a text field. I know 'sum' doesn't work, but is there another solution? '||' is not good because it will take just 2 arguments. Yes you can write an

[GENERAL] concatenate text

2005-09-04 Thread Sterpu Victor
Can I do something like this? SELECT sum(name) FROM table; Where name is a text field. I know 'sum' doesn't work, but is there another solution? '||' is not good because it will take just 2 arguments. Thank you. ---(end of broadcast)--- TIP 4:

Re: [GENERAL] concatenate text

2005-09-04 Thread David Fetter
On Mon, Sep 05, 2005 at 03:00:30AM +0300, Sterpu Victor wrote: Can I do something like this? SELECT sum(name) FROM table; Where name is a text field. I know 'sum' doesn't work, but is there another solution? '||' is not good because it will take just 2 arguments. Currently, you can use a

Re: [GENERAL] concatenate text

2005-09-04 Thread Michael Fuhr
On Mon, Sep 05, 2005 at 03:00:30AM +0300, Sterpu Victor wrote: Can I do something like this? SELECT sum(name) FROM table; Where name is a text field. I know 'sum' doesn't work, but is there another solution? '||' is not good because it will take just 2 arguments. Are you looking for an

Re: [GENERAL] concatenate text

2005-09-04 Thread Allan Wang
On Sun, 2005-09-04 at 20:37 -0400, Allan Wang wrote: On Mon, 2005-09-05 at 03:00 +0300, Sterpu Victor wrote: Can I do something like this? SELECT sum(name) FROM table; You can add a custom aggregate function that turns your data into an array, see