Patch: Code comments: why some text-handling functions are leakproof

2022-01-10 Thread Gurjeet Singh
https://www.postgresql.org/message-id/flat/673096.1630006990%40sss.pgh.pa.us#cd378cba4b990fda070c6fa4b51a069c Best regards, -- Gurjeet Singh http://gurjeet.singh.im/ leakproof_comments.patch Description: Binary data

Begin a transaction on a SAVEPOINT that is outside any transaction

2021-11-22 Thread Gurjeet Singh
ocks ROLLBACK TO SAVEPOINT one; ERROR: ROLLBACK TO SAVEPOINT can only be used in transaction blocks RELEASE SAVEPOINT one; ERROR: RELEASE SAVEPOINT can only be used in transaction blocks Best regards, -- Gurjeet Singh http://gurjeet.singh.im/

Fix comment in pgcrypto tests

2019-05-27 Thread Gurjeet Singh
Please see attached the patch that corrects the file-level SQL comment that indicates which submodule of pgcrypto is being tested. Best regards, -- Gurjeet Singh http://gurjeet.singh.im/ pgcrypto-test-comments.patch Description: Binary data

Re: Fix comment in pgcrypto tests

2019-05-28 Thread Gurjeet Singh
:25:37PM -0700, Gurjeet Singh wrote: > > Please see attached the patch that corrects the file-level SQL comment > that > > indicates which submodule of pgcrypto is being tested. > > Thanks, committed. There was a second one in pgp-decrypt.sql. > -- > Michael > -- Gurjeet Singh http://gurjeet.singh.im/

Re: Proposal: :SQL_EXEC_TIME (like :ROW_COUNT) Variable (psql)

2023-02-23 Thread Gurjeet Singh
On Thu, Feb 23, 2023 at 8:42 PM Kirk Wolak wrote: > I love that my proposal for %T in the prompt, triggered some great > conversations. > > This is not instead of that. That lets me run a query and come back HOURS > later, and know it finished before 7PM like it was supposed to! Neat! I ha

Named Operators

2023-01-12 Thread Gurjeet Singh
Technically correct name of this feature would be Readable Names for Operators, or Pronounceable Names for Operators. But I'd like to call it Named Operators. With this patch in place, the users can name the operators as :some_pronounceable_name: instead of having to choose from the special charac

Re: Named Operators

2023-01-12 Thread Gurjeet Singh
Please see attached a slightly updated patch. There were some comment changes sitting in uncommitted in Git worktree, that were missed. Best regards, Gurjeet http://Gurje.et named_operators_v1.patch Description: Binary data

Re: Named Operators

2023-01-12 Thread Gurjeet Singh
On Thu, Jan 12, 2023 at 1:49 AM Matthias van de Meent wrote: > > On Thu, 12 Jan 2023 at 10:16, Gurjeet Singh wrote: > > > > Technically correct name of this feature would be Readable Names for > > Operators, or Pronounceable Names for Operators. But I'd like t

Re: Named Operators

2023-01-14 Thread Gurjeet Singh
On Thu, Jan 12, 2023 at 5:55 AM Matthias van de Meent wrote: > On Thu, 12 Jan 2023 at 11:59, Gurjeet Singh wrote: > > ... defining an operator > > gives you many additional features that the planner can use to > > optimize your query differently, which it can't do w

Make message strings in fe-connect.c consistent

2023-04-20 Thread Gurjeet Singh
When reviewing a recently committed patch [1] I noticed the odd usage of a format specifier: + libpq_append_conn_error(conn, "invalid %s value: \"%s\"", + "load_balance_hosts", + conn->load_balance_hosts); The oddity is

Re: Make message strings in fe-connect.c consistent

2023-04-20 Thread Gurjeet Singh
On Thu, Apr 20, 2023 at 9:31 PM Tom Lane wrote: > > Gurjeet Singh writes: > > When reviewing a recently committed patch [1] I noticed the odd usage > > of a format specifier: > > > + libpq_append_conn_error(co

Minor code de-duplication in fe-connect.c

2023-04-20 Thread Gurjeet Singh
Commit [1] implements Fisher-Yates shuffling algorithm to shuffle connection addresses, in two places. The attached patch moves the duplicated code to a function, and calls it in those 2 places. [1]: Support connection load balancing in libpq 7f5b19817eaf38e70ad1153db4e644ee9456853e Best regards

Reorder connection markers in libpq TAP tests

2023-04-20 Thread Gurjeet Singh
Commit 7f5b198 introduced TAP tests that use string literals to mark the presence of a query in server logs. For no explicable reason, the tests with the marker 'connect2' occur before the tests that use 'connect1' marker. The attached patch swaps the connection marker strings so that a reader doe

Re: Reorder connection markers in libpq TAP tests

2023-04-20 Thread Gurjeet Singh
On Thu, Apr 20, 2023 at 11:00 PM Gurjeet Singh wrote: > > Commit 7f5b198 introduced TAP tests that use string literals to mark > the presence of a query in server logs. For no explicable reason, the > tests with the marker 'connect2' occur before the tests that use > &

Re: Minor code de-duplication in fe-connect.c

2023-04-21 Thread Gurjeet Singh
On Fri, Apr 21, 2023 at 7:47 AM Robert Haas wrote: > > On Fri, Apr 21, 2023 at 8:25 AM Daniel Gustafsson wrote: > > The reason I left it like this when reviewing and committing is that I > > think it > > makes for more readable code. The amount of lines saved is pretty small, > > and > > "shuf

Re: Correct the documentation for work_mem

2023-04-21 Thread Gurjeet Singh
On Fri, Apr 21, 2023 at 10:15 AM Tom Lane wrote: > > Peter Eisentraut writes: > > On 21.04.23 16:28, Imseih (AWS), Sami wrote: > >> I suggest a small doc fix: > >> “Note that for a complex query, several sort or hash operations might be > >> running simultaneously;” > > > Here is a discussion of

Mark a transaction uncommittable

2023-04-22 Thread Gurjeet Singh
This is a proposal for a new transaction characteristic. I haven't written any code, yet, and am interested in hearing if others may find this feature useful. Many a times we start a transaction that we never intend to commit; for example, for testing, or for EXPLAIN ANALYZE, or after detecting un

Re: [PATCH] Infinite loop while acquiring new TOAST Oid

2023-04-22 Thread Gurjeet Singh
On Thu, Dec 22, 2022 at 10:07 AM Nikita Malakhov wrote: > Any suggestions on the previous message (64-bit toast value ID with > individual counters)? Was this patch ever added to CommitFest? I don't see it in the current Open Commitfest. https://commitfest.postgresql.org/43/ Best regards, Gurj

Re: Doc limitation update proposal: include out-of-line OID usage per TOAST-ed columns

2023-04-22 Thread Gurjeet Singh
On Fri, Apr 21, 2023 at 12:14 AM Nikita Malakhov wrote: > This limitation applies not only to wide tables - it also applies to tables > where TOASTed values > are updated very often. You would soon be out of available TOAST value ID > because in case of > high frequency updates autovacuum cleanu

Re: Minor code de-duplication in fe-connect.c

2023-04-24 Thread Gurjeet Singh
On Mon, Apr 24, 2023 at 5:14 AM Daniel Gustafsson wrote: > > On 21 Apr 2023, at 18:38, Gurjeet Singh wrote: > > > > On Fri, Apr 21, 2023 at 7:47 AM Robert Haas > wrote: > >> > >> On Fri, Apr 21, 2023 at 8:25 AM Daniel Gustafsson > wrote: > >>

Postgres Index Advisor status and GSoC (was: Re: Returning to Postgres community work)

2023-05-11 Thread Gurjeet Singh
On Tue, Aug 31, 2021 at 10:02 AM Gurjeet Singh wrote: > On Tue, Aug 31, 2021 at 8:04 AM Alvaro Herrera > wrote: > > > You know what I've heard? That your index advisor module languishes > > unmaintained and that there's no shortage of people wishing to use it. &

Re: Remove extraneous break condition in logical slot advance function

2023-10-21 Thread Gurjeet Singh
On Fri, Oct 20, 2023 at 7:30 PM Bharath Rupireddy wrote: > > Hi, > > There exists an extraneous break condition in > pg_logical_replication_slot_advance(). When the end of WAL or moveto > LSN is reached, the main while condition helps to exit the loop, so no > separate break condition is needed. A

Replace references to malloc() in libpq documentation with generic language

2023-10-23 Thread Gurjeet Singh
The commit message in the attached patch provides the reasoning, as follows: The user does not benefit from knowing that libpq allocates some/all memory using malloc(). Mentioning malloc() here has a few downsides, and almost no benefits. All the relevant mentions of malloc() are followed by an e

Re: simplehash: preserve consistency in case of OOM

2023-11-17 Thread Gurjeet Singh
On Fri, Nov 17, 2023 at 12:13 PM Andres Freund wrote: > > On 2023-11-17 10:42:54 -0800, Jeff Davis wrote: > > Right now, if allocation fails while growing a hashtable, it's left in > > an inconsistent state and can't be used again. +1 to the patch. > I'm not against allowing this - but I am curi

Re: Change GUC hashtable to use simplehash?

2023-11-17 Thread Gurjeet Singh
On Fri, Nov 17, 2023 at 11:02 AM Jeff Davis wrote: > > I had briefly experimented changing the hash table in guc.c to use > simplehash. It didn't offer any measurable speedup, but the API is > slightly nicer. > > I thought I'd post the patch in case others thought this was a good > direction or ni

Re: Document that server will start even if it's unable to open some TCP/IP ports

2023-09-12 Thread Gurjeet Singh
On Fri, Sep 8, 2023 at 7:52 AM Bruce Momjian wrote: > > On Thu, Sep 7, 2023 at 09:21:07PM -0700, Nathan Bossart wrote: > > On Thu, Sep 07, 2023 at 07:13:44PM -0400, Bruce Momjian wrote: > > > On Thu, Sep 7, 2023 at 02:54:13PM -0700, Nathan Bossart wrote: > > >> IMO the phrase "open a port" is ki

Re: Document that server will start even if it's unable to open some TCP/IP ports

2023-10-01 Thread Gurjeet Singh
On Tue, Sep 26, 2023 at 4:02 PM Bruce Momjian wrote: > > Patch applied back to PG 11. +Peter E. since I received the following automated note: > Closed in commitfest 2023-09 with status: Moved to next CF (petere) Just a note that this patch has been committed (3fea854691), so I have marked the

Re: [PoC/RFC] Multiple passwords, interval expirations

2023-10-04 Thread Gurjeet Singh
I had an idea to simplify this feature/patch and after some validation in internal discussions, I am posting the new approach here. I'd appreciate any feedback and comments. To begin with, the feature we are chasing is to make it convenient for the users to rollover their passwords. Currently ther

Re: Good News Everyone! + feature proposal

2023-10-05 Thread Gurjeet Singh
On Thu, Oct 5, 2023 at 1:52 AM Jon Erdman wrote: > > So I have some good news! At long last I've found a company/manager that > wants to actually factually pay me to do some work on PG!! Congratulations! > For the proposal (this one is a bit Apple specific): because my team > offers managed post

Re: [PoC/RFC] Multiple passwords, interval expirations

2023-10-05 Thread Gurjeet Singh
On Thu, Oct 5, 2023 at 12:04 PM Nathan Bossart wrote: > > On Wed, Oct 04, 2023 at 10:41:15PM -0700, Gurjeet Singh wrote: > > The patches posted in this thread so far attempt to add the ability to > > allow the user to have an arbitrary number of passwords. I believe > >

Re: [PoC/RFC] Multiple passwords, interval expirations

2023-10-05 Thread Gurjeet Singh
On Thu, Oct 5, 2023 at 1:09 PM Jeff Davis wrote: > > > > > I think this would be mighty confusing to users since it's not clear > > that > > adding a password will potentially invalidate a current password > > (which > > might be actively in use), but only if there are already 2 in the > > stack.

Re: [PoC/RFC] Multiple passwords, interval expirations

2023-10-08 Thread Gurjeet Singh
On Fri, Oct 6, 2023 at 1:46 PM Bruce Momjian wrote: > > On Fri, Oct 6, 2023 at 01:20:03PM -0700, Jeff Davis wrote: > > The basic problem, as I see it, is: how do we keep users from > > accidentally dropping the wrong password? Generated unique names or > > I thought we could auto-remove old passw

Re: [PoC/RFC] Multiple passwords, interval expirations

2023-10-08 Thread Gurjeet Singh
On Sun, Oct 8, 2023 at 10:29 AM Bruce Momjian wrote: > > I was speaking of autoremoving in cases where we are creating a new one, > and taking the previous new one and making it the old one, if that was > not clear. Yes, I think I understood it differently. I understood it to mean that this behav

Re: [PoC/RFC] Multiple passwords, interval expirations

2023-10-08 Thread Gurjeet Singh
On Fri, Oct 6, 2023 at 1:29 PM Jeff Davis wrote: > > On Thu, 2023-10-05 at 14:28 -0700, Gurjeet Singh wrote: > > > This way there's a notion of a 'new' and 'old' passwords. > > IIUC, you are proposing that there are exactly two slots, NEW and OLD. &

Re: [PoC/RFC] Multiple passwords, interval expirations

2023-10-09 Thread Gurjeet Singh
On Sun, Oct 8, 2023 at 1:01 PM Gurjeet Singh wrote: > > On Fri, Oct 6, 2023 at 1:29 PM Jeff Davis wrote: > > > > On Thu, 2023-10-05 at 14:28 -0700, Gurjeet Singh wrote: > > > > > This way there's a notion of a 'new' and 'old' passwords.

Re: [PoC/RFC] Multiple passwords, interval expirations

2023-10-09 Thread Gurjeet Singh
On Mon, Oct 9, 2023 at 2:31 AM Gurjeet Singh wrote: > > Next steps: > - Break the patch into a series of smaller patches. Please see attached the same v3 patch, but now split into 3 separate patches. Each patch in the series depends on the previous patch to have been applied. I have

Minor edit to src/bin/pg_upgrade/IMPLEMENTAION

2023-10-09 Thread Gurjeet Singh
The attached patch adds the word 'databases' to show that template0, template1 and postgres are databases in a default installation. Best regards, Gurjeet http://Gurje.et pg_upgrade.implementation.diff Description: Binary data

Re: pg_reload_conf() synchronously

2022-11-05 Thread Gurjeet Singh
On Sat, Nov 5, 2022 at 11:23 AM Andres Freund wrote: > > As far as I know, Gurjeet has been annoyed only with non-user-settable > > GUCs for one connection (correct me of course), there was nothing > > fancy with isolation tests, yet. Not saying that this is useless for > > isolation tests, this

Re: Named Operators

2023-01-20 Thread Gurjeet Singh
On Sat, Jan 14, 2023 at 6:14 AM Gurjeet Singh wrote: > > I agree that an identifier _surrounded_ by the same token (e.g. #foo#) > or the pairing token (e.g. {foo}) looks better aesthetically, so I am > okay with any of the following variations of the scheme, as well: > > \#foo

Re: Named Operators

2023-01-20 Thread Gurjeet Singh
On Fri, Jan 20, 2023 at 9:32 AM Ted Yu wrote: > > Since `validIdentifier` doesn't modify the contents of `name` string, it > seems that there is no need to create `tmp` string in `validNamedOperator`. > You can pass the start and end offsets into the string (name) as second and > third parameter

Re: generate_series for timestamptz and time zone problem

2023-01-29 Thread Gurjeet Singh
On Sat, Nov 12, 2022 at 10:44 AM Tom Lane wrote: > However, what it shouldn't be is part of this patch. It's worth > pushing it separately to have a record of that decision. I've > now done that, so you'll need to rebase to remove that delta. > > I looked over the v5 patch very briefly, and have

Re: generate_series for timestamptz and time zone problem

2023-01-30 Thread Gurjeet Singh
On Mon, Jan 30, 2023 at 4:07 PM Tom Lane wrote: > Gurjeet Singh writes: > > [ generate_series_with_timezone.v6.patch ] > > The cfbot isn't terribly happy with this. It looks like UBSan > is detecting some undefined behavior. Possibly an uninitialized > variable? It

Assert fcinfo has enough args before allowing parameter access (was: Re: generate_series for timestamptz and time zone problem)

2023-01-30 Thread Gurjeet Singh
On Mon, Jan 30, 2023 at 11:50 PM Gurjeet Singh wrote: > It was the classical case of out-of-bounds access. > This mistake would've been caught early if there were assertions > preventing access beyond the number of arguments passed to the > function. I'll send the assert_e

pg_reload_conf() synchronously

2022-11-04 Thread Gurjeet Singh
In an internal conversation it was seen that for some tests that want to enforce a behaviour, a behaviour that is controlled by a GUC, we _need_ to perform a sleep for an arbitrary amount of time. Alternatively, executing the rest of the test on a new connection also helps to get the expected behav

Automatic notification for top transaction IDs

2021-06-22 Thread Gurjeet Singh
onse at any point in the protocol. Best regards, -- Gurjeet Singh http://gurjeet.singh.im/ notify_xid.patch Description: Binary data

Automatic notification of top transaction IDs

2021-06-30 Thread Gurjeet Singh
email [4] is considered a continuation of a previous thread, _and_ the 'Latest attachment' entry points to a different email, even though my email [4] contained a patch. [4]: https://www.postgresql.org/message-id/CABwTF4VS+HVm11XRE_Yv0vGmG=5kpYdx759RyJEp9F+fiLTU=q...@mail.gmail.com

Re: Automatic notification of top transaction IDs

2021-06-30 Thread Gurjeet Singh
The proposed patch is attached. Best regards, -- Gurjeet Singh http://gurjeet.singh.im/ On Wed, Jun 30, 2021 at 5:56 PM Gurjeet Singh wrote: > > (Re-sending this email, because the Commitfest app mistakenly [3] > considered previous email [4] to be part of the old thread, whereas it

Slightly improve initdb --sync-only option's help message

2021-07-06 Thread Gurjeet Singh
modify any data To match the wording of --sync-only option: write contents of data directory to disk; helpful after --no-sync option Clearly specify the system operation used for the option perform fsync on data directory; helpful after --no-sync option Best regards, -- Gurjeet Singh http

Warn if initdb's --sync-only option is mixed with other options

2021-07-06 Thread Gurjeet Singh
Z5NJQ9rKY9tN82NXM8QH%2BiQ%40mail.gmail.com Best regards, -- Gurjeet Singh http://gurjeet.singh.im/ v1-0001-Warn-if-sync-only-is-used-with-other-options.patch Description: Binary data

Patch: Don't set LoadedSSL unless secure_initialize succeeds

2022-05-21 Thread Gurjeet Singh
The initialization in PostmasterMain() blindly turns on LoadedSSL, irrespective of the outcome of secure_initialize(). I don't think that's how it should behave, primarily because of the pattern followed by the other places that call secure_initialize(). This patch makes PostmasterMain() behave id

Re: Patch: Don't set LoadedSSL unless secure_initialize succeeds

2022-05-25 Thread Gurjeet Singh
On Sun, May 22, 2022 at 12:17 AM Daniel Gustafsson wrote: > > On 22 May 2022, at 08:41, Gurjeet Singh wrote: > > > The initialization in PostmasterMain() blindly turns on LoadedSSL, > > irrespective of the outcome of secure_initialize(). > > This call is invoked with i

Re: Patch: Don't set LoadedSSL unless secure_initialize succeeds

2022-05-25 Thread Gurjeet Singh
On Mon, May 23, 2022 at 8:51 PM Tom Lane wrote: > > Daniel Gustafsson writes: > >> On 22 May 2022, at 08:41, Gurjeet Singh wrote: > >> The initialization in PostmasterMain() blindly turns on LoadedSSL, > >> irrespective of the outcome of secure_initialize()

Re: Patch: Don't set LoadedSSL unless secure_initialize succeeds

2022-05-25 Thread Gurjeet Singh
On Wed, May 25, 2022 at 10:05 PM Gurjeet Singh wrote: > I have added a comment to be_tls_init(), which I hope explains this > difference in treatment of errors. I have also added comments to > be_tls_init(), explaining why we don't destroy/free the global > SSL_context varia

Re: Patch: Don't set LoadedSSL unless secure_initialize succeeds

2022-05-26 Thread Gurjeet Singh
On Thu, May 26, 2022 at 12:16 PM Tom Lane wrote: > Gurjeet Singh writes: > > On Mon, May 23, 2022 at 8:51 PM Tom Lane wrote: > >> The comments for secure_initialize() and be_tls_init() both explain > >> this already. > > > The comments above secure_initia

Re: Patch: Don't set LoadedSSL unless secure_initialize succeeds

2022-05-26 Thread Gurjeet Singh
On Thu, May 26, 2022 at 1:00 PM Robert Haas wrote: > > On Thu, May 26, 2022 at 1:05 AM Gurjeet Singh wrote: > > There's an symmetry, almost a diametric opposition, between how SSL I meant "an asymmetry". > > initialization error is treated when it occurs durin

Re: Patch: Don't set LoadedSSL unless secure_initialize succeeds

2022-05-26 Thread Gurjeet Singh
On Thu, May 26, 2022 at 2:40 PM Tom Lane wrote: > > Robert Haas writes: > > I think you're overreacting to a behavior that isn't really very surprising. > > > If we don't initialize SSL the first time, we don't have a working SSL > > stack. If we didn't choose to die at that point, we'd be starti

Re: Patch: Don't set LoadedSSL unless secure_initialize succeeds

2022-05-26 Thread Gurjeet Singh
On Thu, May 26, 2022 at 4:13 PM Tom Lane wrote: > Gurjeet Singh writes: > > On Thu, May 26, 2022 at 12:16 PM Tom Lane wrote: > >> so maybe those comments in libpq-be.h > >> should be moved to their respective functions? In any case, I'm not > >> exc

Re: Hardening PostgreSQL via (optional) ban on local file system access

2022-06-24 Thread Gurjeet Singh
On Fri, Jun 24, 2022 at 4:13 PM Andres Freund wrote: > On 2022-06-25 00:08:13 +0200, Hannu Krosing wrote: > > 3) should this be back-patched (we can provide batches for all > > supported PgSQL versions) > > Err, what? Translation: Backpatching these changes to any stable versions will not be acc

Re: Hardening PostgreSQL via (optional) ban on local file system access

2022-06-24 Thread Gurjeet Singh
(fixed your top-posting) On Fri, Jun 24, 2022 at 4:59 PM Hannu Krosing wrote: > On Sat, Jun 25, 2022 at 1:46 AM Gurjeet Singh wrote: > > > > On Fri, Jun 24, 2022 at 4:13 PM Andres Freund wrote: > > > On 2022-06-25 00:08:13 +0200, Hannu Krosing wrote: > > > >

Re: [PoC/RFC] Multiple passwords, interval expirations

2022-06-30 Thread Gurjeet Singh
I am planning on picking it up next week; right now picking up steam, and reviewing a different, smaller patch. At his behest, I had a conversation with Joshua (OP), and have his support to pick up and continue working on this patch. I have a some ideas of my own, on what this patch should do, but

Re: generate_series for timestamptz and time zone problem

2022-06-30 Thread Gurjeet Singh
On Tue, Jun 21, 2022 at 7:56 AM Przemysław Sztoch wrote: > There is another patch. > It works, but one thing is wrongly done because I lack knowledge. Thank you for continuing to work on it despite this being your first time contributing, and despite the difficulties. I'll try to help as much as

Fwd: Unprivileged user can induce crash by using an SUSET param in PGOPTIONS

2022-07-20 Thread Gurjeet Singh
egards, Gurjeet http://Gurje.et Forwarded Conversation Subject: Unprivileged user can induce crash by using an SUSET param in PGOPTIONS ---- From: Gurjeet Singh Date: Mon, Jul 4, 2022 at 10:24 AM To: Postgres Security Cc: Bossart, Nathan While poking at plperl's GUC

Re: Fwd: Unprivileged user can induce crash by using an SUSET param in PGOPTIONS

2022-07-21 Thread Gurjeet Singh
On Thu, Jul 21, 2022 at 2:44 PM Tom Lane wrote: > > Gurjeet Singh writes: > > While poking at plperl's GUC in an internal discussion, I was able to > > induce a crash (or an assertion failure in assert-enabled builds) as > > an unprivileged user. > > My investi

Re: Fwd: Unprivileged user can induce crash by using an SUSET param in PGOPTIONS

2022-07-21 Thread Gurjeet Singh
On Thu, Jul 21, 2022 at 3:29 PM Nathan Bossart wrote: > > On Thu, Jul 21, 2022 at 05:44:11PM -0400, Tom Lane wrote: > > Right. So there are basically two things we could do about this: > > > > 1. set_config_option could decline to call pg_parameter_aclcheck > > if not IsTransactionState(), instea

Re: Fwd: Unprivileged user can induce crash by using an SUSET param in PGOPTIONS

2022-07-21 Thread Gurjeet Singh
On Thu, Jul 21, 2022 at 4:35 PM Gurjeet Singh wrote: > I like the idea of performing library initialization in > InitPostgres(), as it performs the first transaction of the > connection, and because of the libraries' ability to gin up new GUC > variables that might need special h

Re: `make check` doesn't pass on MacOS Catalina

2022-08-06 Thread Gurjeet Singh
On Tue, Apr 20, 2021 at 9:06 AM Andrew Dunstan wrote: > > On 4/20/21 11:02 AM, Tom Lane wrote: > > Aleksander Alekseev writes: > >> While trying to build PostgreSQL from source (master branch, 95c3a195) on a > >> MacBook I discovered that `make check` fails: > > This is the usual symptom of not h

Re: Patch proposal: New hooks in the connection path

2022-08-13 Thread Gurjeet Singh
On Mon, Aug 8, 2022 at 3:51 AM Drouvot, Bertrand wrote: > Please find attached v2-0004-connection_hooks.patch /* * Stop here if it was bad or a cancel packet. ProcessStartupPacket * already did any appropriate error reporting. */ if (status != STATUS_OK) +{ +#ifnd

Re: Patch proposal: New hooks in the connection path

2022-08-13 Thread Gurjeet Singh
(reposting the same review, with many grammatical fixes) On Mon, Aug 8, 2022 at 3:51 AM Drouvot, Bertrand wrote: > Please find attached v2-0004-connection_hooks.patch /* * Stop here if it was bad or a cancel packet. ProcessStartupPacket * already did any appropriate error repor

Returning to Postgres community work

2021-08-30 Thread Gurjeet Singh
m/GurjeetResume.pdf PS: Hacker News announcement is at https://news.ycombinator.com/item?id= Best regards, -- Gurjeet Singh http://gurjeet.singh.im/

Re: Returning to Postgres community work

2021-08-30 Thread Gurjeet Singh
On Mon, Aug 30, 2021 at 10:53 PM Gurjeet Singh wrote: > PS: Hacker News announcement is at https://news.ycombinator.com/item?id= https://news.ycombinator.com/item?id=28364406 Best regards, -- Gurjeet Singh http://gurjeet.singh.im/

Re: Returning to Postgres community work

2021-08-31 Thread Gurjeet Singh
On Tue, Aug 31, 2021 at 8:04 AM Alvaro Herrera wrote: > > On 2021-Aug-30, Gurjeet Singh wrote: > > > I'm very happy to announce that I now work for Supabase [1]. They > > have hired me so that I can participate in, and contribute to the > > Postgres communit

Re: Slightly improve initdb --sync-only option's help message

2021-07-28 Thread Gurjeet Singh
he true intent of the option, because generally a "write" operation is still limited to dirtying the OS buffers, and does not guarantee sync-to-disk. It'd be better if the help message said, either "flush all database files to disk and exit",or "sync all database fil

Re: Slightly improve initdb --sync-only option's help message

2021-08-16 Thread Gurjeet Singh
tdb > >> help > >> output match the other exiting options in there. Barring objections, I > >> think > >> this is ready. > > > > LGTM. Thanks! > > Pushed to master, thanks! Thank you Daniel and Nathan! Much appreciated. Best regards, -- Gurjeet Singh http://gurjeet.singh.im/

Proposal: Division operator for (interval / interval => double precision)

2024-06-23 Thread Gurjeet Singh
Is there a desire to have a division operator / that takes dividend and divisor of types interval, and results in a quotient of type double precision. This would be helpful in calculating how many times the divisor interval can fit into the dividend interval. To complement this division operator,

Re: DecodeInterval fixes

2023-07-08 Thread Gurjeet Singh
On Sat, Jul 8, 2023 at 1:33 PM Tom Lane wrote: > > Gurjeet Singh writes: > > On Fri, Jul 7, 2023 at 4:13 PM Tom Lane wrote: > >> The ECPG datetime datatype support code has been basically unmaintained > >> for years, and has diverged quite far at this point from th

Re: BUG #18016: REINDEX TABLE failure

2023-07-10 Thread Gurjeet Singh
On Sun, Jul 9, 2023 at 7:21 AM Richard Veselý wrote: > > ... there's no shortage of people that suffer from sluggish > pg_dump/pg_restore cycle and I imagine there are any number of people that > would be interested in improving bulk ingestion which is often a bottleneck > for analytical worklo

Re: BUG #18016: REINDEX TABLE failure

2023-07-11 Thread Gurjeet Singh
On Sun, Jul 9, 2023 at 7:18 AM Tom Lane wrote: > > Michael Paquier writes: > > That should be OK, I assume. However, if this is improved and > > something we want to support in the long-run I guess that a TAP test > > may be appropriate. > > I do not see the point of a TAP test. It's not like t

Re: Document that server will start even if it's unable to open some TCP/IP ports

2023-07-11 Thread Gurjeet Singh
On Mon, Jun 19, 2023 at 5:48 PM Bruce Momjian wrote: > > On Tue, Jun 13, 2023 at 11:11:04PM -0400, Tom Lane wrote: > > > > There is certainly an argument that such a condition indicates that > > something's very broken in our configuration and we should complain. > > But I'm not sure how exciting

Re: MERGE ... RETURNING

2023-07-11 Thread Gurjeet Singh
On Fri, Jul 7, 2023 at 3:48 PM Dean Rasheed wrote: > > On Thu, 6 Jul 2023 at 06:13, Gurjeet Singh wrote: > > > > > One minor annoyance is that, due to the way that pg_merge_action() and > > > pg_merge_when_clause() require access to the MergeActionState, they

Re: MERGE ... RETURNING

2023-07-11 Thread Gurjeet Singh
On Tue, Jul 11, 2023 at 1:43 PM Gurjeet Singh wrote: > > In the above hunk, if there's an exception/ERROR, I believe we should > PG_RE_THROW(). If there's a reason to continue, we should at least set > rslot = NULL, otherwise we may be returning an uninitialized value to >

Better help output for pgbench -I init_steps

2023-07-12 Thread Gurjeet Singh
These patches were created during an unrelated discussion about pgbench. Please see emails [1] - [6] linked below, for the past discussion. In brief: > $ pgbench -i -I dtGvp -s 500 The init-steps are severely under-documented in pgbench --help output. I think at least a pointer to the the p

Re: Better help output for pgbench -I init_steps

2023-07-12 Thread Gurjeet Singh
On Wed, Jul 12, 2023 at 3:08 AM Peter Eisentraut wrote: > > On 12.07.23 09:42, Gurjeet Singh wrote: > > These two variants show the two extremes; bare minimum vs. everything > > but the kitchen sink. So one may feel the need to find a middle ground > > and provide a "

Re: CommandStatus from insert returning when using a portal.

2023-07-12 Thread Gurjeet Singh
On Wed, Jul 12, 2023 at 1:03 PM Dave Cramer wrote: > > With a simple insert such as > > INSERT INTO test_table (cnt) VALUES (1), (2) RETURNING id > > if a portal is used to get the results then the CommandStatus is not returned > on the execute only when the portal is closed. After looking at thi

Re: Duplicated LLVMJitHandle->lljit assignment?

2023-07-12 Thread Gurjeet Singh
On Wed, Jul 12, 2023 at 5:22 PM Matheus Alcantara wrote: > > I was reading the jit implementation and I notice that the lljit field of > LLVMJitHandle is being assigned twice on llvm_compile_module function, is this > correct? I'm attaching a supposed fixes that removes the second assignment. I >

Re: MERGE ... RETURNING

2023-07-13 Thread Gurjeet Singh
On Thu, Jul 13, 2023 at 8:38 AM Dean Rasheed wrote: > > On Tue, 11 Jul 2023 at 21:43, Gurjeet Singh wrote: > > { oid => '9499', descr => 'command type of current MERGE action', > > - proname => 'pg_merge_action', provolatile =>

Re: Fix search_path for all maintenance commands

2023-07-13 Thread Gurjeet Singh
On Thu, Jul 13, 2023 at 11:56 AM Jeff Davis wrote: > > The current approach seemed to get support from Noah, Nathan, and Greg > Stark. > > Concerns were raised by Gurjeet, Tom, and Robert in the 16 cycle; but I didn't see Tom's or Robert's concerns raised in this thread. I see now that for some r

Re: Fix search_path for all maintenance commands

2023-07-13 Thread Gurjeet Singh
On Thu, Jul 13, 2023 at 1:37 PM David G. Johnston wrote: > > I'm against simply breaking the past without any recourse as what we did for > pg_dump/pg_restore still bothers me. I'm sure this is tangential, but can you please provide some context/links to the change you're referring to here. Be

Re: harmonize password reuse in vacuumdb, clusterdb, and reindexdb

2023-07-18 Thread Gurjeet Singh
On Mon, Jul 17, 2023 at 1:47 PM Nathan Bossart wrote: > > Here is a new version of the patch in which I've updated this comment as > proposed. Gurjeet, do you have any other concerns about this patch? With the updated comment, the patch looks good to me. Best regards, Gurjeet http://Gurje.et

Re: There should be a way to use the force flag when restoring databases

2023-07-19 Thread Gurjeet Singh
On Tue, Jul 18, 2023 at 12:53 AM Joan wrote: > > Since posgres 13 there's the option to do a FORCE when dropping a database > (so it disconnects current users) Documentation here: > https://www.postgresql.org/docs/current/sql-dropdatabase.html > > I am currently using dir format for the output >

Re: Issue in _bt_getrootheight

2023-07-19 Thread Gurjeet Singh
On Tue, Jul 11, 2023 at 9:35 AM Ahmed Ibrahim wrote: > > We have been working on the pg_adviser extension whose goal is to suggest > indexes by creating virtual/hypothetical indexes and see how it affects the > query cost. > > The hypothetical index shouldn't take any space on the disk (allocate

Re: There should be a way to use the force flag when restoring databases

2023-07-20 Thread Gurjeet Singh
On Thu, Jul 20, 2023 at 2:10 AM Daniel Gustafsson wrote: > > > On 19 Jul 2023, at 19:28, Gurjeet Singh wrote: > > > > The docs for 'pg_restore --create` say "Create the database before > > restoring into it. If --clean is also specified, drop and re

Re: MERGE ... RETURNING

2023-07-20 Thread Gurjeet Singh
On Fri, Jul 14, 2023 at 1:55 AM Dean Rasheed wrote: > > On Thu, 13 Jul 2023 at 20:14, Jeff Davis wrote: > > > > On Thu, 2023-07-13 at 18:01 +0100, Dean Rasheed wrote: > > > For some use cases, I can imagine allowing OLD/NEW.colname would mean > > > you wouldn't need pg_merge_action() (if the colu

Re: MERGE ... RETURNING

2023-07-20 Thread Gurjeet Singh
On Mon, Jul 17, 2023 at 12:43 PM Jeff Davis wrote: > > On Fri, 2023-07-14 at 09:55 +0100, Dean Rasheed wrote: > > I found a 10-year-old thread discussing adding support for OLD/NEW to > > RETURNING [1], but it doesn't look like anything close to a > > committable solution was developed, or even a

Re: table_open/table_close with different lock mode

2023-07-20 Thread Gurjeet Singh
On Thu, Jul 20, 2023 at 11:38 PM Junwang Zhao wrote: > > On Fri, Jul 21, 2023 at 2:26 PM Michael Paquier wrote: > > > > On Fri, Jul 21, 2023 at 02:05:56PM +0800, Junwang Zhao wrote: > > > I noticed there are some places calling table_open with > > > RowExclusiveLock but table_close with NoLock, l

Re: Issue in _bt_getrootheight

2023-07-24 Thread Gurjeet Singh
On Fri, Jul 21, 2023 at 10:42 AM Tom Lane wrote: > > Gurjeet Singh writes: > > Please see attached the patch that does this. Let me know if this patch > > helps. > > I don't like this patch one bit, because it adds a lot of overhead > (i.e., an extra index_open/c

Re: psql not responding to SIGINT upon db reconnection

2023-07-24 Thread Gurjeet Singh
On Mon, Jul 24, 2023 at 9:26 AM Tristan Partin wrote: > attached patch +/* + * Restore the default SIGINT behavior while within libpq. Otherwise, we + * can never exit from polling for the database connection. Failure to + * restore is non-fatal. + */ +

Re: MERGE ... RETURNING

2023-07-25 Thread Gurjeet Singh
On Fri, Jul 21, 2023 at 7:17 PM Dean Rasheed wrote: > > On Mon, 17 Jul 2023 at 20:43, Jeff Davis wrote: > > > > > > Maybe instead of a function it could be a special table reference > > > > like: > > > > > > > > MERGE ... RETURNING MERGE.action, MERGE.action_number, id, val? > > > > > > The ben

Re: There should be a way to use the force flag when restoring databases

2023-07-26 Thread Gurjeet Singh
On Sun, Jul 23, 2023 at 6:09 AM Ahmed Ibrahim wrote: > > Hi everyone, > > I have been working on this. This is a proposed patch for it so we have a > force option for DROPping the database. > > I'd appreciate it if anyone can review. Hi Ahmed, Thanks for working on this patch! + +int

Re: Doc limitation update proposal: include out-of-line OID usage per TOAST-ed columns

2023-08-20 Thread Gurjeet Singh
On Wed, Apr 26, 2023 at 4:48 AM David Rowley wrote: > > On Sun, 23 Apr 2023, 3:42 am Gurjeet Singh, wrote: >> >> I anticipate that edits to Appendix K Postgres Limits will prompt >> improving the note in there about the maximum column limit, That note >> is too

psql --no-connect option

2023-08-24 Thread Gurjeet Singh
Currently, psql exits if a database connection is not established when psql is launched. Sometimes it may be useful to launch psql without connecting to the database. For example, a user may choose to start psql and then pipe commands via stdin, one of which may eventually perform the \connect com

  1   2   >