Marc Mamin-2 wrote
> I would misuse GUC variables for this.
> (using the functions current_setting and set_config)
>
> define a set get and switch fuction (I use operators for better
> readability)
> something like:
>
> select 'a' ==> 'foo'
> 'a'
> select 'b' <==> 'foo'
> 'a'
> select <== 'foo'
> 'b'
>
>
> and in your query:
>
> SELECT
> case when test then col <==> 'foo' else <== 'foo' end
Is it possible to alter GUC on a record-by-record basis?
Is this something you have actually done?
Even if it does technically work this seems like a last-resort kind of
solution. The syntax (though that could be hidden in a wrapper function) is
definitely unusual and the abuse of the GUC system in this manner is
surprising.
How would this interface with a window function? The main consideration is
dealing with multiple partitions and the fact that a window column
calculation requires the use of a function while this solution would seem to
preclude that.
David J.
--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Detecting-change-in-event-properties-tp5775959p5775975.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.