[Question] Can someone provide some links related to the MemoryContext?
Hi hackers, I am learning the MemoryContext subsystem, but I really don't know where to find it's document (The PostgreSQL Document just provide some spi function). Can someone provide me some solutions? Thanks in advance! Yours, Wen Yi
[PATCH]Add a tip to the check mode
Hi community, when I learn the source of PostgreSQL, I think it's better to add a tip to the postgres "check mode", this can help the postgres's user when they check the postgres's data directory. src/backend/bootstrap/bootstrap.c if (check_only) { SetProcessingMode(NormalProcessing); CheckerModeMain(); abort(); } Instead of if (check_only) { SetProcessingMode(NormalProcessing); CheckerModeMain(); printf("PostgreSQL check success, there's no problem\n"); abort(); } Yours, Wen Yi Add-a-tip-to-the-check-mode.patch Description: Binary data
Re: [PATCH]Add a tip to the check mode
I'm so sorry for my careless, you're right. But I still think there should add a tip to our user when there's check ok, because when I use the check mode, it didn't give me any message (If there's no error happend) and just exit, like this: [beginnerc@bogon devel]$ postgres --check -D /home/beginnerc/pgsql/data [beginnerc@bogon devel]$ [beginnerc@bogon devel]$ echo $? 0 That's confused me, until I print the return value. So I think we should add this tip. I fix and recommit the patch, thanks very much for your reply. Yours, Wen Yi -- Original -- From: "Matthias van de Meent" https://neon.tech) Add-a-tip-to-the-check-mode[fix].patch Description: Binary data
[May be a bug] double free or corruption
Hi community, I use the PostgreSQL 17devel on x86_64-pc-linux-gnu, compiled by gcc (GCC) 13.1.1 20230614 (Red Hat 13.1.1-4), 64-bit.(Fedora Linux) And I use the gdb to debug the postgres, just test the pg_ctl. As you can see: --- [Switching to Thread 0x77dce740 (LWP 83554)] start_postmaster () at pg_ctl.c:455 455 if (pm_pid < 0) (gdb) .. 462 if (pm_pid > 0) (gdb) 476 if (setsid() < 0) (gdb) .. 489 if (log_file != NULL) (gdb) 490 cmd = psprintf("exec \"%s\" %s%s < \"%s\" >> \"%s\" 2>&1", (gdb) .. 497 (void) execl("/bin/sh", "/bin/sh", "-c", cmd, (char *) NULL); (gdb) . process 83554 is executing new program: /usr/bin/bash Error in re-setting breakpoint 1: No source file named /home/postgres/project/postgres/src/devel/src/bin/pg_ctl/pg_ctl.c. Error in re-setting breakpoint 2: No source file named /home/postgres/project/postgres/src/devel/src/bin/pg_ctl/pg_ctl.c. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". process 83554 is executing new program: /home/postgres/postgres/bin/bin/postgres [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". BFD: warning: /home/postgres/.cache/debuginfod_client/d25eaf3596d9455fe9725f6e9cd1aa5433f31b92/debuginfo has a section extending past end of file Error while reading shared library symbols for /lib64/libstdc++.so.6: `/home/postgres/.cache/debuginfod_client/d25eaf3596d9455fe9725f6e9cd1aa5433f31b92/debuginfo': can't read symbols: file format not recognized. .[Attaching after Thread 0x77e8d480 (LWP 83554) fork to child process 83559] [New inferior 3 (process 83559)] [Detaching after fork from parent process 83554] [Inferior 2 (process 83554) detached] double free or corruption (out) Fatal signal: Aborted - Backtrace - corrupted double-linked list Fatal signal: Aborted - Backtrace - done server started 0x5557bf5908b0 ??? 0x5557bf6cb4cd ??? 0x7f040125fb6f ??? 0x7f04012b0844 ??? 0x7f040125fabd ??? 0x7f040124887e ??? 0x7f040124960e ??? 0x7f04012ba774 ??? 0x7f04012bc93f ??? 0x7f04012bf1cd ??? 0x5557bf98272a ??? 0x5557bf7eb93c ??? 0x5557bf643b48 ??? 0x5557bf643d11 ??? 0x7f04012b3af2 ??? 0x5557bfc37d48 ??? 0x7f04014e31f2 ??? 0x7f04012ae906 ??? 0x7f040133486f ??? 0x ??? - A fatal error internal to GDB has been detected, further debugging is not possible. GDB will now terminate. This is a bug, please report it. For instructions, see: <https://www.gnu.org/software/gdb/bugs/>;. Aborted (core dumped) [postgres@fedora postgres]$ -- As you can see, the gdb tell me I should report this, because gdb think there's a double-free. But I check the postgres, it keep the run rightly, like this:(Before I run the psql, I print the log file) - 2023-07-26 22:16:17.489 CST [83554] LOG: database system is ready to accept connections [postgres@fedora postgres]$ psql psql (17devel) Type "help" for help. postgres=# \q [postgres@fedora postgres]$ ---------- Can someone notice this problem? Thanks in advance Yours, Wen Yi
Re: Things I don't like about \du's "Attributes" column
I think the output need to change, like this: postgres=# \du+ List of roles Role name | Login | Attributes | Password | Valid until | Connection limit | Description ---+---+-+--+-+--+- test | | Inherit | | | | test2 | Can | Inherit | Has | | | wenyi | Can | Superuser +| | | | | | Create DB +| | | | | | Create role+| | | | | | Inherit+| | | | | | Replication+| | | | | | Bypass RLS | | | | (3 rows)
Re: Things I don't like about \du's "Attributes" column
I think we can change the output like this: postgres=# \du List of roles Role name | Login | Attributes | Password | Valid until | Connection limit ---+---+-+--+-+-- test | | Inherit | | | test2 | Can | Inherit | Has | | wenyi | Can | Superuser +| | | | | Create DB +| | | | | Create role+| | | | | Inherit+| | | | | Replication+| | | | | Bypass RLS | | | (3 rows) And I submit my the patch, have a look? Yours, Wen Yi -- Original -- From: "Pavel Luzanov" <p.luza...@postgrespro.ru>; Date: Sun, Feb 18, 2024 07:14 PM To: "David G. Johnston"<david.g.johns...@gmail.com>; Cc: "Tom Lane"<t...@sss.pgh.pa.us>;"Jim Nasby"<jim.na...@gmail.com>;"Robert Haas"<robertmh...@gmail.com>;"pgsql-hackers"<pgsql-hackers@lists.postgresql.org>; Subject: Re: Things I don't like about \du's "Attributes" column On 17.02.2024 00:37, David G. Johnston wrote: On Mon, Feb 12, 2024 at 2:29?6?2PM Pavel Luzanov <p.luza...@postgrespro.ru> wrote: regress_du_role1 | no| Inherit | no| 2024-12-31 00:00:00+03(invalid) | 50 | Group role without password but with valid untilregress_du_role2 | yes | Inherit | yes | | Not allowed| No connections allowedregress_du_role3 | yes | | yes | | 10 | User without attributesregress_du_su| yes | Superuser+| yes | | 3(ignored) | Superuser but with connection limit Per the recent bug report, we should probably add something like (ignored) after the 50 connections for role1 since they are not allowed to login so the value is indeed ignored. Hm, but the same logic applies to "Password?" and "Valid until" for role1 without login attribute. The challenge is how to display it for unprivileged users. But they can't see password information. So, displaying 'Valid until' as '(irrelevant)' for privileged users and real value for others looks badly.What can be done in this situation. 0. Show different values as described above. 1. Don't show 'Valid until' for unprivileged users at all. The same logic as for 'Password?'. With possible exception: user can see 'Valid until' for himself.May be too complicated?2. Tom's advise: Not sure it's worth worrying about Show real values for 'Valid until' and 'Connection limit' without any hints.3. The best solution, which I can't see now. --Pavel Luzanov Postgres Professional: https://postgrespro.com v6-0002-psql-Rethinking-of-du-command.patch Description: Binary data
How can udf c function return table, not the rows?
Hi hackers, I am trying to design a new "pg_get_functiondef" function extension, like this: CREATE FUNCTION pg_get_functiondef(OID, VARIADIC OID[]) RETURNS TABLE (OID oid, pg_get_functiondef text) AS 'pg_get_functiondef', 'pg_get_functiondef_mul' LANGUAGE C; And I have read the
Re:How can udf c function return table, not the rows?
You're right, thanks! Wen Yi wen...@qq.com ---Original--- From: "David G. Johnston"