Final Fix :
execute 'insert into tmp'||abc|| ' select $1.*' using new;
Thanks
On Wed, Jun 26, 2013 at 12:18 PM, Adarsh Sharma wrote:
> Able to fix but still new error :(
>
>
> test=# CREATE OR REPLACE FUNCTION tmp_trigger_function()
> test-# RETURNS TRIGGER AS $$
> test$# DECLARE
> test$# s
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|| ' values
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
test$#
> Thanks
>
>
> On Wed, Jun 26, 2013 at 10:52 AM, Ian Lawrence Barwick
> wrote:
>>
>> 2013/6/26 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_
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 ;
test$#
2013/6/26 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;
EXECUTE 'insert into tmp'||abc|| 'values ( NEW.* )';
This works :)
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';
test
Am 24.03.2010 14:41, schrieb Merlin Moncure:
On Wed, Mar 24, 2010 at 6:22 AM, Frank jansen 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
On Wed, Mar 24, 2010 at 6:22 AM, Frank jansen 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 always complaing
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
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
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.
--
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
arzer
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 stat
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 qu
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
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
countri
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 ve
"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 || 't
"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
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 test_v_0
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 cli
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
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 anyon
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 file
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 a
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 http://www.postgresql.org/doc
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 a
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 us
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: Hav
31 matches
Mail list logo