public inbox for [email protected]  
help / color / mirror / Atom feed
From: Rafi Shamim <[email protected]>
To: [email protected]
To: [email protected]
Subject: [pgjdbc/pgjdbc] 248b2e: fix: Update function volatility in SchemaTest setu...
Date: Tue, 14 Feb 2023 11:43:24 -0800
Message-ID: <pgjdbc/pgjdbc/push/refs/heads/master/[email protected]> (raw)

  Branch: refs/heads/master
  Home:   https://github.com/pgjdbc/pgjdbc
  Commit: 248b2eec547f3411d17c37814165cb1cef9daa85
      https://github.com/pgjdbc/pgjdbc/commit/248b2eec547f3411d17c37814165cb1cef9daa85
  Author: Rafi Shamim <[email protected]>
  Date:   2023-02-14 (Tue, 14 Feb 2023)

  Changed paths:
    M pgjdbc/src/test/java/org/postgresql/test/jdbc4/jdbc41/SchemaTest.java

  Log Message:
  -----------
  fix: Update function volatility in SchemaTest setup (#2806)

PostgreSQL allows you to label a function as immutable even if it is
not. But this can lead to non-deterministic results. See:

https://www.postgresql.org/docs/current/sql-createfunction.html
```
IMMUTABLE indicates that the function cannot modify the database and
always returns the same result when given the same argument values;
that is, it does not do database lookups or otherwise use information
not directly present in its argument list. If this option is given,
any call of the function with all-constant arguments can be immediately
replaced with the function value.
```

And:
https://www.postgresql.org/docs/current/xfunc-volatility.html
```
Labeling a function IMMUTABLE when it really isn't might allow it
to be prematurely folded to a constant during planning, resulting
in a stale value being re-used during subsequent uses of the plan.
This is a hazard when using prepared statements or when using function
languages that cache plans (such as PL/pgSQL).
...
It is generally unwise to select from database tables within an IMMUTABLE
function at all, since the immutability will be broken if the table contents
ever change. However, PostgreSQL does not enforce that you do not do that.
```







reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: [pgjdbc/pgjdbc] 248b2e: fix: Update function volatility in SchemaTest setu...
  In-Reply-To: <pgjdbc/pgjdbc/push/refs/heads/master/[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox