CONCAT function

Started by Vinayakover 11 years ago3 messagesgeneral
Jump to latest
#1Vinayak
vinpokale@gmail.com

Hello,

The pg_catalog.concat() is defined as STABLE function.

As per my understanding a STABLE function cannot modify the database and is
guaranteed to return the same results given the same arguments for all rows
within a single statement.
Example:
current_timestamp family of functions qualify as stable, since their values
do not change within a transaction.

An IMMUTABLE function cannot modify the database and is guaranteed to return
the same results given the same arguments forever.

why was STABLE preferred for concat() over IMMUTABLE?

-----
Regards,
Vinayak,

--
View this message in context: http://postgresql.1045698.n5.nabble.com/CONCAT-function-tp5817884.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Vinayak (#1)
Re: CONCAT function

Vinayak <vinpokale@gmail.com> writes:

The pg_catalog.concat() is defined as STABLE function.
why was STABLE preferred for concat() over IMMUTABLE?

concat() invokes datatype output functions, which are not necessarily
immutable. An easy example is that timestamptz_out's results depend
on the TimeZone setting.

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Vinayak
vinpokale@gmail.com
In reply to: Tom Lane (#2)
Re: CONCAT function

Thank you for reply.

concat() invokes datatype output functions, which are not necessarily
immutable. An easy example is that timestamptz_out's results depend
on the TimeZone setting.

I understood.

-----
Regards,
Vinayak,

--
View this message in context: http://postgresql.1045698.n5.nabble.com/CONCAT-function-tp5817884p5818267.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general