pltcl crashes due to a syntax error

2024-05-31 Thread a.kozhemyakin
Hello hackers, When executing the following query on master branch: CREATE EXTENSION pltcl; CREATE or replace PROCEDURE test_proc5(INOUT a text)     LANGUAGE pltcl     AS $$     set aa [concat $1 "+" $1]     return [list $aa $aa])     $$; CALL test_proc5('abc'); CREATE EXTEN

Re: Add memory context type to pg_backend_memory_contexts view

2024-05-31 Thread Michael Paquier
On Fri, May 31, 2024 at 12:35:58PM +1200, David Rowley wrote: > This follows what we do in other places. If you look at explain.c, > you'll see lots of "???"s. > > I think if you're worried about corrupted memory, then garbled output > in pg_get_backend_memory_contexts wouldn't be that high on th

Re: To what extent should tests rely on VACUUM ANALYZE?

2024-05-31 Thread Alexander Lakhin
29.03.2024 11:59, Alexander Lakhin wrote: But it looks like subselect is not the only test that can fail due to vacuum instability. I see that create_index also suffers from cranky ConditionalLockBufferForCleanup() (+if (rand() % 10 == 0)  ... Just for the record, I think I've reproduced the sa

Re: Explicit specification of index ensuring uniqueness of foreign columns

2024-05-31 Thread David G. Johnston
On Friday, May 31, 2024, Tom Lane wrote: > Kaiting Chen writes: > > I'd like to resurrect a subset of my proposal in [1], specifically that: > > The FOREIGN KEY constraint syntax gains a [ USING INDEX index_name ] > clause > > optionally following the referenced column list. > > ... > > Whil

Re: Explicit specification of index ensuring uniqueness of foreign columns

2024-05-31 Thread Tom Lane
Kaiting Chen writes: > I'd like to resurrect a subset of my proposal in [1], specifically that: > The FOREIGN KEY constraint syntax gains a [ USING INDEX index_name ] clause > optionally following the referenced column list. > ... > While, in this minimal reproduction, the two indexes are inte

Re: Ambiguous description on new columns

2024-05-31 Thread Peter Smith
On Wed, May 29, 2024 at 8:04 PM vignesh C wrote: > > On Wed, 22 May 2024 at 14:26, Peter Smith wrote: > > > > On Tue, May 21, 2024 at 8:40 PM PG Doc comments form > > wrote: > > > > > > The following documentation comment has been logged on the website: > > > > > > Page: > > > https://www.postg

meson and check-tests

2024-05-31 Thread Ashutosh Bapat
Hi Tristan, Using make I can run only selected tests under src/test/regress using TESTS=... make check-tests. I didn't find any way to do that with meson. meson test --suite regress runs all the regression tests. We talked this off-list at the conference. It seems we have to somehow avoid passing

Re: meson "experimental"?

2024-05-31 Thread Andres Freund
Hi, On May 30, 2024 8:03:33 AM PDT, Andrew Dunstan wrote: >On Thu, May 30, 2024 at 6:32 AM Aleksander Alekseev < >aleksan...@timescale.com> wrote: > >> >> >> By a quick look on the buildfarm we seem to use Ninja >= 1.11.1. >> However since Meson can use both Ninja and VS as a backend I'm not >>

Re: Schema variables - new implementation for Postgres 15

2024-05-31 Thread Pavel Stehule
pá 31. 5. 2024 v 15:49 odesílatel Wolfgang Walther napsal: > Pavel Stehule: > > When you write RAISE NOTICE '%', x, then PLpgSQL parser rewrite it to > > RAISE NOTICE '%', SELECT $1 > > > > There is no parser just for expressions. > > That's why my suggestion in [1] already made a difference betw

Re: Add memory context type to pg_backend_memory_contexts view

2024-05-31 Thread David Christensen
> On May 30, 2024, at 5:36 PM, David Rowley wrote: > > On Fri, 31 May 2024 at 07:21, David Christensen wrote: >> Giving this a once-through, this seems straightforward and useful. I >> have a slight preference for keeping "name" the first field in the >> view and moving "type" to the second,

Re: Schema variables - new implementation for Postgres 15

2024-05-31 Thread Wolfgang Walther
Pavel Stehule: When you write RAISE NOTICE '%', x, then PLpgSQL parser rewrite it to RAISE NOTICE '%', SELECT $1 There is no parser just for expressions. That's why my suggestion in [1] already made a difference between: SELECT var; and SELECT col, var FROM table, var; So the "only requir

Re: Schema variables - new implementation for Postgres 15

2024-05-31 Thread Pavel Stehule
> > > > >> In this case you could still write: >> >> RAISE NOTICE '% %', x, (SELECT a,b FROM y); >> >> (assuming only x is a variable here) >> > no - y was a composite variable. When you write RAISE NOTICE '%', x, then PLpgSQL parser rewrite it to RAISE NOTICE '%', SELECT $1 There is no parser ju

Re: Schema variables - new implementation for Postgres 15

2024-05-31 Thread Pavel Stehule
pá 31. 5. 2024 v 15:29 odesílatel Wolfgang Walther napsal: > Pavel Stehule: > > The session variables can be used in queries, but should be used in > > PL/pgSQL expressions, and then the mandatory usage in FROM clause will > > do lot of problems and unreadable code like > > > > DO $$ > > BEGIN >

Re: Schema variables - new implementation for Postgres 15

2024-05-31 Thread Wolfgang Walther
Pavel Stehule: The session variables can be used in queries, but should be used in PL/pgSQL expressions, and then the mandatory usage in FROM clause will do lot of problems and unreadable code like DO $$ BEGIN   RAISE NOTICE '% %', (SELECT x FROM x), (SELECT a,b FROM y); END $$ This require

Re: Schema variables - new implementation for Postgres 15

2024-05-31 Thread Pavel Stehule
pá 31. 5. 2024 v 15:02 odesílatel Pavel Stehule napsal: > > > pá 31. 5. 2024 v 13:37 odesílatel Wolfgang Walther < > walt...@technowledgy.de> napsal: > >> Pavel Stehule: >> > But in this case you could make variables and tables share the same >> > namespace, i.e. forbid creating a variabl

Re: Schema variables - new implementation for Postgres 15

2024-05-31 Thread Pavel Stehule
pá 31. 5. 2024 v 13:37 odesílatel Wolfgang Walther napsal: > Pavel Stehule: > > But in this case you could make variables and tables share the same > > namespace, i.e. forbid creating a variable with the same name as an > > already existing table. > > > > > > It helps, but not on 100%

Re: Improve the connection failure error messages

2024-05-31 Thread Nisha Moond
On Fri, Apr 26, 2024 at 1:10 PM Daniel Gustafsson wrote: > > > On 22 Mar 2024, at 11:42, Nisha Moond wrote: > > > Here is the v4 patch with changes required in slotfuncs.c and slotsync.c > > files. > > - errmsg("could not connect to the primary server: %s", err)); > + errmsg("\"%s\"

Re: 回复: An implementation of multi-key sort

2024-05-31 Thread Yao Wang
I added two optimizations to mksort which exist on qsort_tuple(): 1. When selecting pivot, always pick the item in the middle of array but not by random. Theoretically it has the same effect to old approach, but it can eliminate some unstable perf test results, plus a bit perf benefit by removing

Re: Schema variables - new implementation for Postgres 15

2024-05-31 Thread Wolfgang Walther
Pavel Stehule: But in this case you could make variables and tables share the same namespace, i.e. forbid creating a variable with the same name as an already existing table. It helps, but not on 100% - there is a search path I think we can ignore the search_path for this discussi

Re: Schema variables - new implementation for Postgres 15

2024-05-31 Thread Pavel Stehule
pá 31. 5. 2024 v 13:10 odesílatel Wolfgang Walther napsal: > Pavel Stehule: > > 2. But my main argument is, it is not really safe - it solves Peter's > > use case, but if I use a reverse example of Peter's case, I still have a > > problem. > > > > I can have a variable x, and then I can write que

Re: Schema variables - new implementation for Postgres 15

2024-05-31 Thread Wolfgang Walther
Pavel Stehule: 2. But my main argument is, it is not really safe - it solves Peter's use case, but if I use a reverse example of Peter's case, I still have a problem. I can have a variable x, and then I can write query like `SELECT x FROM x`; but if somebody creates table x(x int), then the q

Re: Schema variables - new implementation for Postgres 15

2024-05-31 Thread Pavel Stehule
pá 31. 5. 2024 v 11:46 odesílatel Dmitry Dolgov <9erthali...@gmail.com> napsal: > > On Tue, May 28, 2024 at 05:18:02PM GMT, Pavel Stehule wrote: > > > > I propose another variants. First we can introduce pseudo function VAR( > ). > > The argument should be session variables. The name of this funct

Re: meson "experimental"?

2024-05-31 Thread Aleksander Alekseev
Hi, >> By a quick look on the buildfarm we seem to use Ninja >= 1.11.1. >> However since Meson can use both Ninja and VS as a backend I'm not >> certain which section would be most appropriate for naming the minimal >> required version of Ninja. > > When I tried building with the VS backend it ble

Re: Switch background worker on/off in runtime.

2024-05-31 Thread Kashif Zeeshan
Hi ISHAN On Fri, May 31, 2024 at 2:28 PM ISHAN CHHANGANI . < f20200...@hyderabad.bits-pilani.ac.in> wrote: > Hi, > > Is it possible to switch on/off a background worker in runtime? > As per my understanding there is no such way to do it on runtime. But you can kill it by using the following com

Re: Schema variables - new implementation for Postgres 15

2024-05-31 Thread Dmitry Dolgov
> On Tue, May 28, 2024 at 05:18:02PM GMT, Pavel Stehule wrote: > > I propose another variants. First we can introduce pseudo function VAR( ). > The argument should be session variables. The name of this function can be > pgvar, globvar, ... We can talk about good name, it should not be too long, >

Switch background worker on/off in runtime.

2024-05-31 Thread ISHAN CHHANGANI .
Hi, Is it possible to switch on/off a background worker in runtime? worker.bgw_flags = BGWORKER_SHMEM_ACCESS; worker.bgw_start_time = BgWorkerStart_PostmasterStart; I want to switch off the worker based on some flag value, etc, either from the main process or the worker itself. Are there any al

Re: 001_rep_changes.pl fails due to publisher stuck on shutdown

2024-05-31 Thread Peter Smith
On Wed, May 29, 2024 at 9:00 PM Alexander Lakhin wrote: > > Hello hackers, > > As a recent buildfarm test failure [1] shows: > [14:33:02.374](0.333s) ok 23 - update works with dropped subscriber column > ### Stopping node "publisher" using mode fast > # Running: pg_ctl -D > /home/bf/bf-build/adder

Re: Fix possible dereference null pointer (PQprint)

2024-05-31 Thread Daniel Gustafsson
> On 27 May 2024, at 16:52, Ranier Vilela wrote: > In the function *PQprint*, the variable po->fieldName can be NULL. Yes. > See the checks a few lines up. Indeed, let's check it. for (numFieldName = 0; po->fieldName && po->fieldName[numFieldName]; numFieldNa