Re: src/test/modules/test_regex/test_regex.c typo issue

2023-02-04 Thread Tom Lane
jian he writes: > in src/test/modules/test_regex/test_regex.c > ... > I think "expected" should be replaced with "missing". > the "missing" should be replaced with "expected". It looks correct to me as-is. cpattern->re_info is the data-under-test, flags->info is the presumed-correct reference

How to implement read operations for my own access method?

2023-02-04 Thread jack...@gmail.com
Hi,I'm trying to implement my own access method. But I find the functions baout read is difficult. Can you give me an existed easy extension that impelment the tableamroutine to reference? I ho[e it's not complicated like heap_am,and it support insert sqls and select sqls.Thanks

Re: Underscores in numeric literals

2023-02-04 Thread Dean Rasheed
On Thu, 2 Feb 2023 at 22:40, Peter Eisentraut wrote: > > On 31.01.23 17:09, Dean Rasheed wrote: > > On Tue, 31 Jan 2023 at 15:28, Peter Eisentraut > > wrote: > >> > >> Did you have any thoughts about what to do with the float types? I > >> guess we could handle those in a separate patch? > >> >

Re: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher

2023-02-04 Thread Amit Kapila
On Thu, Feb 2, 2023 at 2:03 PM Önder Kalacı wrote: > >> >> and if there's more >> than one candidate index pick any one. Additionally, we can allow >> disabling the use of an index scan for this particular case. If we are >> too worried about API change for allowing users to specify the index >>

Re: Use windows VMs instead of windows containers on the CI

2023-02-04 Thread Bharath Rupireddy
On Fri, Feb 3, 2023 at 3:27 PM Thomas Munro wrote: > > On Fri, Feb 3, 2023 at 6:57 PM Andres Freund wrote: > > And pushed! I think an improvement in CI times of this degree is pretty > > awesome. > > +1 > > A lot of CI compute time is saved. The Cirrus account[1] was > previously hitting the 4

Re: Exit walsender before confirming remote flush in logical replication

2023-02-04 Thread Amit Kapila
On Fri, Feb 3, 2023 at 5:38 PM Hayato Kuroda (Fujitsu) wrote: > > Dear Amit, Sawada-san, > > > > IIUC there is no difference between smart shutdown and fast shutdown > > > in logical replication walsender, but reading the doc[1], it seems to > > > me that in the smart shutdown mode, the server

Re: Weird failure with latches in curculio on v15

2023-02-04 Thread Andres Freund
Hi, On 2023-02-03 10:54:17 -0800, Nathan Bossart wrote: > @@ -146,7 +146,25 @@ ExecuteRecoveryCommand(const char *command, const char > *commandName, >*/ > fflush(NULL); > pgstat_report_wait_start(wait_event_info); > + > + /* > + * PreRestoreCommand() is used to tell

Re: run pgindent on a regular basis / scripted manner

2023-02-04 Thread Andres Freund
Hi, On 2023-02-03 20:18:48 -0800, Noah Misch wrote: > On Fri, Feb 03, 2023 at 12:52:50PM -0500, Tom Lane wrote: > > Andrew Dunstan writes: > > > On 2023-01-22 Su 17:47, Tom Lane wrote: > > >> Yeah. That's one of my biggest gripes about pgperltidy: if you insert > > >> another assignment in a

Re: BUG: Postgres 14 + vacuum_defer_cleanup_age + FOR UPDATE + UPDATE

2023-02-04 Thread Michail Nikolaev
Hello, Andres. > Not sure I like TransactionIdRetreatSafely() as a name. Maybe > TransactionIdRetreatClamped() is better? I think it is better to just replace TransactionIdRetreatedBy. It is not used anymore after `v3-0001-WIP-Fix-corruption-due-to-vacuum_defer_cleanup_ag.patch` - so, it is

Re: Exit walsender before confirming remote flush in logical replication

2023-02-04 Thread Andres Freund
Hi, On 2023-02-02 11:21:54 +0530, Amit Kapila wrote: > The main problem we want to solve here is to avoid shutdown failing in > case walreceiver/applyworker is busy waiting for some lock or for some > other reason as shown in the email [1]. Isn't handling this part of the job of

Re: [PATCH] Compression dictionaries for JSONB

2023-02-04 Thread Andres Freund
Hi, On 2023-02-03 14:39:31 +0400, Pavel Borisov wrote: > On Fri, 3 Feb 2023 at 14:04, Alvaro Herrera wrote: > > > > This patch came up at the developer meeting in Brussels yesterday. > > https://wiki.postgresql.org/wiki/FOSDEM/PGDay_2023_Developer_Meeting#v16_Patch_Triage > > > > First, as far

Re: run pgindent on a regular basis / scripted manner

2023-02-04 Thread Andrew Dunstan
On 2023-02-04 Sa 06:34, Andres Freund wrote: ISTM that we're closer to being able to enforce pgindent than perltidy. At the same time, I think the issue of C code in HEAD not being indented is more pressing - IME it's much more common to have to touch a lot of C code than to have to touch a

Re: BUG: Postgres 14 + vacuum_defer_cleanup_age + FOR UPDATE + UPDATE

2023-02-04 Thread Andres Freund
Hi, Heikki, Andrey, CCing you because you wrote commit 6655a7299d835dea9e8e0ba69cc5284611b96f29 Author: Heikki Linnakangas Date: 2019-07-24 20:24:07 +0300 Use full 64-bit XID for checking if a deleted GiST page is old enough. On 2023-01-07 19:09:56 -0800, Andres Freund wrote: > I

Re: Weird failure with latches in curculio on v15

2023-02-04 Thread Andres Freund
Hi, On 2023-02-02 11:06:19 +0900, Michael Paquier wrote: > > - the error message for a failed restore command seems to have gotten > > worse: > > could not restore file \"%s\" from archive: %s" > > -> > > "%s \"%s\": %s", commandName, command > > IMO, we don't lose any context with this

undersized unions

2023-02-04 Thread Andres Freund
Hi, gcc warns about code like this: typedef union foo { int i; long long l; } foo; foo * assign(int i) { foo *p = (foo *) __builtin_malloc(sizeof(int)); p->i = i; return p; } : In function 'assign': :9:6: warning: array subscript 'foo[0]' is partly outside array bounds of

Re: Allow tailoring of ICU locales with custom rules

2023-02-04 Thread Daniel Verite
Laurenz Albe wrote: > Cool so far. Now I created a database with that locale: > > CREATE DATABASE teutsch LOCALE_PROVIDER icu ICU_LOCALE german_phone > LOCALE "de_AT.utf8" TEMPLATE template0; > > Now the rules are not in "pg_database": The parameter after ICU_LOCALE is passed

Re: Weird failure with latches in curculio on v15

2023-02-04 Thread Nathan Bossart
On Sat, Feb 04, 2023 at 03:30:29AM -0800, Andres Freund wrote: > That's kind of my problem with these changes. They try to introduce new > abstraction layers, but don't provide real abstraction, because they're > very tightly bound to the way the functions were called before the > refactoring.

Re: recovery modules

2023-02-04 Thread Nathan Bossart
On Sat, Feb 04, 2023 at 11:59:20AM +0900, Michael Paquier wrote: > + ArchiveModuleCallbacks struct filled with the callback function pointers > for > This needs a structname markup. > > + can use state->private_data to store it. > And here it would be structfield. fixed -- Nathan Bossart

Re: Fix GUC_NO_SHOW_ALL test scenario in 003_check_guc.pl

2023-02-04 Thread Nitin Jadhav
> I don't particularly see why that needs to be the case. Notably, > if we're interested in enforcing a policy even for extension GUCs, > guc.sql can't really do that since who knows whether the extension's > author will bother to run that test with the extension loaded. > On the other hand,

Re: run pgindent on a regular basis / scripted manner

2023-02-04 Thread Tom Lane
Justin Pryzby writes: > Would you want to make those the default options of the in-tree indent ? > Or provide a shortcut like --postgresql ? Hmmm ... inserting all of those as the default options would likely make it impossible to update pg_bsd_indent itself with anything like its current indent

Re: proposal: psql: psql variable BACKEND_PID

2023-02-04 Thread Pavel Stehule
Hi pá 3. 2. 2023 v 20:27 odesílatel Corey Huinker napsal: > > > On Fri, Feb 3, 2023 at 5:42 AM Pavel Stehule > wrote: > >> Hi >> >> We can simply allow an access to backend process id thru psql variable. I >> propose the name "BACKEND_PID". The advantages of usage are simple >> accessibility

Re: Allow tailoring of ICU locales with custom rules

2023-02-04 Thread Laurenz Albe
On Sat, 2023-02-04 at 14:41 +0100, Daniel Verite wrote: > Laurenz Albe wrote: > > > Cool so far.  Now I created a database with that locale: > > > >  CREATE DATABASE teutsch LOCALE_PROVIDER icu ICU_LOCALE german_phone > >     LOCALE "de_AT.utf8" TEMPLATE template0; > > > > Now the rules

Re: How to implement read operations for my own access method?

2023-02-04 Thread Andrey Borodin
On Sat, Feb 4, 2023 at 12:59 AM jack...@gmail.com wrote: > > > Hi,I'm trying to implement my own access method. But I find the functions > baout read is difficult. > Can you give me an existed easy extension that impelment the tableamroutine > to reference? I ho[e > it's not complicated like

Re: First draft of back-branch release notes is done

2023-02-04 Thread Jonathan S. Katz
> On Feb 4, 2023, at 10:24 AM, Tom Lane wrote: > > ... at > > https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=f282b026787da69d88a35404cf62f1cc21cfbb7c > > As usual, please send corrections/comments by Sunday. While reviewing for the release announcement, I noticed this

Re: Temporary tables versus wraparound... again

2023-02-04 Thread Greg Stark
I think that was spurious. It looked good when we looked at it yesterday. The rest that failed seemed unrelated and was also taking on my SSL patch too. I talked to Andres about the possibility of torn reads in the pg_class stats but those are all 4-byte columns so probably safe. And in any case

Re: pg_stat_statements and "IN" conditions

2023-02-04 Thread Dmitry Dolgov
> On Thu, Feb 02, 2023 at 04:05:54PM +0100, Dmitry Dolgov wrote: > > On Thu, Feb 02, 2023 at 03:07:27PM +0100, Alvaro Herrera wrote: > > This appears to have massive conflicts. Would you please rebase? > > Sure, I was already mentally preparing myself to do so in the view of > recent changes in

Re: run pgindent on a regular basis / scripted manner

2023-02-04 Thread Justin Pryzby
On Sat, Feb 04, 2023 at 11:07:59AM -0500, Tom Lane wrote: > (I haven't forgotten that I'm on the hook to import pg_bsd_indent > into our tree. Will get to that soon.) +1 for that - it's no surprise that you have trouble convincing people to follow the current process: 1) requires using a hacked

Re: BUG: Postgres 14 + vacuum_defer_cleanup_age + FOR UPDATE + UPDATE

2023-02-04 Thread Andrey Borodin
On Sat, Feb 4, 2023 at 2:57 AM Andres Freund wrote: > > Is there a good way to make breakage in the page recycling mechanism > visible with gist? I guess to see corruption, I'd have to halt a scan > before a page is visited with gdb, then cause the page to be recycled > prematurely in another

Re: proposal: psql: psql variable BACKEND_PID

2023-02-04 Thread Corey Huinker
> > with doc and unsetting variable > > Regards > > Pavel > > Patch applies. Manually testing confirms that it works, at least for the connected state. I don't actually know how get psql to invoke DISCONNECT, so I killed the dev server and can confirm [81:14:57:01 EST] corey=# \echo

Re: run pgindent on a regular basis / scripted manner

2023-02-04 Thread Tom Lane
Andres Freund writes: > ISTM that we're closer to being able to enforce pgindent than > perltidy. At the same time, I think the issue of C code in HEAD not > being indented is more pressing - IME it's much more common to have to > touch a lot of C code than to have to touch a lot fo perl files.

Re: BUG: Postgres 14 + vacuum_defer_cleanup_age + FOR UPDATE + UPDATE

2023-02-04 Thread Peter Geoghegan
On Sat, Feb 4, 2023 at 2:57 AM Andres Freund wrote: > Is there a good way to make breakage in the page recycling mechanism > visible with gist? I guess to see corruption, I'd have to halt a scan > before a page is visited with gdb, then cause the page to be recycled > prematurely in another

Re: proposal: psql: show current user in prompt

2023-02-04 Thread Pavel Stehule
Hi pá 3. 2. 2023 v 21:43 odesílatel Pavel Stehule napsal: > > > pá 3. 2. 2023 v 21:21 odesílatel Tom Lane napsal: > >> Pavel Stehule writes: >> > Both patches are very simple - and they use almost already prepared >> > infrastructure. >> >> It's not simple at all to make the psql feature

Re: Amcheck verification of GiST and GIN

2023-02-04 Thread Andrey Borodin
Thank for working on this, Peter! On Fri, Feb 3, 2023 at 6:50 PM Peter Geoghegan wrote: > > I think that we should focus on getting the GiST patch into shape for > commit first, since that seems easier. > Here's the next version. I've focused on GiST part in this revision. Changes: 1.

File descriptors in exec'd subprocesses

2023-02-04 Thread Thomas Munro
While investigating code paths that use system() and popen() and trying to write latch-multiplexing replacements, which I'll write about separately, leaks of $SUBJECT became obvious. On a FreeBSD box, you can see the sockets, pipes and data and WAL files that the subprocess inherits: create

Re: File descriptors in exec'd subprocesses

2023-02-04 Thread Thomas Munro
On Sun, Feb 5, 2023 at 1:00 PM Thomas Munro wrote: > SUSv3 (POSIX 2008) Oh, oops, 2008 actually corresponds to SUSv4. Hmm.

Re: Weird failure with latches in curculio on v15

2023-02-04 Thread Michael Paquier
On Sat, Feb 04, 2023 at 10:03:54AM -0800, Nathan Bossart wrote: > Okay. Michael, why don't we revert the shell_restore stuff for now? Once > the archive modules interface changes and the fix for this > SIGTERM-during-system() problem are in, I will work through this feedback > and give recovery

Re: undersized unions

2023-02-04 Thread Michael Paquier
On Sat, Feb 04, 2023 at 05:07:08AM -0800, Andres Freund wrote: > : In function 'assign': > :9:6: warning: array subscript 'foo[0]' is partly outside array > bounds of 'unsigned char[4]' [-Warray-bounds=] > 9 | p->i = i; > | ^~ > :8:22: note: object of size 4 allocated by

Re: pg_stat_statements and "IN" conditions

2023-02-04 Thread Michael Paquier
On Sat, Feb 04, 2023 at 06:08:41PM +0100, Dmitry Dolgov wrote: > Here is the rebased version. To adapt to the latest changes, I've marked > ArrayExpr with custom_query_jumble to implement this functionality, but > tried to make the actual merge logic relatively independent. Otherwise, > everything

what's the meaning of key?

2023-02-04 Thread jack...@gmail.com
I'm doing research on heap_am, and for heap_beginscan func, I find out that there is a arg called nkeys, I use some sqls as examples like 'select * from t;' and 'select * from t where a = 1', but it is always zero, can you give me some descriptions for this? what's it used for?

Where is the filter?

2023-02-04 Thread jack...@gmail.com
When I use 'select * from t where a = 1'; And I debug to find where the 'a = 1' is used, when I arrive ExecScan in src/backend/executor/execScan.c, line 158, where this 'a = 1' is stored in? jack...@gmail.com

Re: undersized unions

2023-02-04 Thread Tom Lane
Michael Paquier writes: > On Sat, Feb 04, 2023 at 05:07:08AM -0800, Andres Freund wrote: >> We actually have a fair amount of code like that, but currently are >> escaping most of the warnings, because gcc doesn't know that palloc() is >> an allocator. With more optimizations (particularly with

Re: proposal: psql: psql variable BACKEND_PID

2023-02-04 Thread Pavel Stehule
Hi so 4. 2. 2023 v 21:36 odesílatel Corey Huinker napsal: > with doc and unsetting variable >> >> Regards >> >> Pavel >> >> > Patch applies. > > Manually testing confirms that it works, at least for the connected state. > I don't actually know how get psql to invoke DISCONNECT, so I killed the

Re: File descriptors in exec'd subprocesses

2023-02-04 Thread Tom Lane
Thomas Munro writes: > On Sun, Feb 5, 2023 at 1:00 PM Thomas Munro wrote: >> SUSv3 (POSIX 2008) > Oh, oops, 2008 actually corresponds to SUSv4. Hmm. Worst case, if we come across some allegedly-supported platform without O_CLOEXEC, we #define that to zero. Said platform is no worse off than