Re: Typo in PL/pgSQL trigger Example 43.4?

2023-10-09 Thread Daniel Gustafsson
> On 7 Oct 2023, at 22:22, Tom Lane  wrote:
> 
> "David G. Johnston"  writes:
>> On Sat, Oct 7, 2023 at 11:11 AM Kirk Parker  wrote:
>>> INSERT INTO emp_audit SELECT 'D', now(), user, OLD.*; -- <= ARGUMENT IN 
>>> QUESTION
>>> The emp_audit table has a column named 'userid', which in actual usage
>>> (next-to-last line quoted) is populated by 'user' which seems undefined in
>>> the context.  Was that intended to be 'current_user', or am I missing
>>> something?
> 
>> user is a valid pseudo-function:
>> https://www.postgresql.org/docs/current/functions-info.html#FUNCTIONS-INFO-SESSION
> 
> Yeah, either way has the same result.  However, I wonder if we should
> change this example to use current_user for clarity.  It does look
> more like it's intended to be a variable or column reference than
> a built-in function.

Agreed, and "user" is a hard search term to use for discovering what it is.  +1
for changing to current_user.

--
Daniel Gustafsson





Example numeric constants aren't valid?

2023-10-09 Thread PG Doc comments form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/16/sql-syntax-lexical.html
Description:

Hi,

Re. Docs page:
https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS-NUMERIC

I noticed that the following are specified as valid numeric constants:

1_500_000_000
0b10001000_
0o_1_755
0x_
1.618_034

So I'd expect something like:

SELECT 1.618_034;

...to return 1.618034? But instead I get 1.618.

And:

SELECT 1_500_000_000::text;

...results in a: ERROR: syntax error at or near "::"

Which seems at odds to what the docs say:
"For visual grouping, underscores can be inserted between digits. These have
no further effect on the value of the constant."

I'm left not really understanding how to use _ in numerical constants?

Tim


Re: Example numeric constants aren't valid?

2023-10-09 Thread Vik Fearing

On 10/6/23 20:49, PG Doc comments form wrote:
>

I'm left not really understanding how to use _ in numerical constants?


You are reading the documentation for 16, but you are using 14 or lower. 
 If you want this functionality, you need to upgrade your server.

--
Vik Fearing





Re: Example numeric constants aren't valid?

2023-10-09 Thread Tim Needham
Oh goodness, sorry Vik.

On Mon, Oct 9, 2023 at 11:37 AM Vik Fearing  wrote:

> On 10/6/23 20:49, PG Doc comments form wrote:
>  >
> > I'm left not really understanding how to use _ in numerical constants?
>
> You are reading the documentation for 16, but you are using 14 or lower.
>   If you want this functionality, you need to upgrade your server.
> --
> Vik Fearing
>
>


Re: Typo in PL/pgSQL trigger Example 43.4?

2023-10-09 Thread Tom Lane
Daniel Gustafsson  writes:
>> On 7 Oct 2023, at 22:22, Tom Lane  wrote:
>> Yeah, either way has the same result.  However, I wonder if we should
>> change this example to use current_user for clarity.  It does look
>> more like it's intended to be a variable or column reference than
>> a built-in function.

> Agreed, and "user" is a hard search term to use for discovering what it is.  
> +1
> for changing to current_user.

OK, I'll take care of this later today.

regards, tom lane




Re: ODBC options

2023-10-09 Thread Brad White
On Fri, Oct 6, 2023 at 2:30 PM Bruce Momjian  wrote:

> On Tue, Oct  3, 2023 at 05:34:01PM -0500, Brad White wrote:
> >   I was trying to figure how to set the log directory on my Windows
> client
> > using a parameter in the connection string. Short answer is that you
> can't.
> > But you can using the DSN settings.
> > I was under the impression that going DSN-less and using the
> parameters on the
> > connection string, we were free from the effects of the DSN settings.
> > That's not true.
> > The DSN settings become the default values, overridden by anything in the
> > connection string.
> > Conversely, there are two settings which, for reasons that escape
> me, can't be
> > set via the connection string.
> > In the process, I found the documentation on the ODBC settings to be
> scattered
> > and inconsistent, so I documented all the settings and their
> abbreviations in a
> > spreadsheet.  Is there a useful place or format where I can post that?
> >
> > Spreadsheet is here if anyone wants to look at it.
> > https://www.dropbox.com/scl/fi/v1uj1umtj20k1ljenodvy/
> > psqlODBC-Configuration-Options.xlsx?rlkey=fit9kbgy0fv0fr9vt0u0a9oim&dl=0
>
> Please see:
>
> https://odbc.postgresql.org/faq.html#1.6
>

I'm confused.
I see that it says to send bug reports to the odbc mailing list.
This isn't a bug report, but I did already send a shortened version there.
Was there something else you wanted to see?
Happy to provide any additional documentation if there is something that I
missed.

Thanks,
Brad.