From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | [patch] GUC source file and line number |
Date: | 2008-08-28 17:08:58 |
Message-ID: | 20080828170858.GF8424@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
Here's a patch to add source file and line numbers to GUC variables.
Basically this makes pg_settings look like this:
alvherre=# select name, setting, sourcefile, sourceline from pg_settings where name like '%work%';
name | setting | sourcefile | sourceline
------------------------+---------+--------------------------------------------+------------
autovacuum_max_workers | 3 | |
maintenance_work_mem | 32768 | /pgsql/install/00head/data/postgresql.conf | 119
work_mem | 2048 | /pgsql/install/00head/data/workmem.conf | 4
(3 lignes)
This should make life easier for tools trying to find the config file
each setting is from (and possibly edit it).
It was initially authored by Magnus, but I had to hit it with the clue
stick until it understood reset sources, i.e. to make it behave sanely
when a session has a SET value and then a SIGHUP causes the backend to
read a config file that has changed underneath it:
-- initial value was 1MB
alvherre=# select name, setting, sourcefile, sourceline from pg_settings where name = 'work_mem';
name | setting | sourcefile | sourceline
------------------------+---------+--------------------------------------------+------------
work_mem | 1024 | /pgsql/install/00head/data/workmem.conf | 1
(1 ligne)
alvherre=# set work_mem to 200;
SET
alvherre=# select name, setting, sourcefile, sourceline from pg_settings where name = 'work_mem';
name | setting | sourcefile | sourceline
------------------------+---------+--------------------------------------------+------------
work_mem | 200 | |
(1 ligne)
-- SIGHUP happened here, file was changed to 2MB and the setting moved some lines below
alvherre=# select name, setting, sourcefile, sourceline from pg_settings where name = 'work_mem';
name | setting | sourcefile | sourceline
------------------------+---------+--------------------------------------------+------------
work_mem | 200 | |
(1 ligne)
alvherre=# reset work_mem ;
RESET
alvherre=# select name, setting, sourcefile, sourceline from pg_settings where name = 'work_mem';
name | setting | sourcefile | sourceline
------------------------+---------+--------------------------------------------+------------
work_mem | 2048 | /pgsql/install/00head/data/workmem.conf | 4
(1 ligne)
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Attachment | Content-Type | Size |
---|---|---|
guc-sourcefile.patch | text/x-diff | 29.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-08-28 17:59:59 | WIP patch: add parser location info to most expression node types |
Previous Message | Brendan Jurd | 2008-08-28 16:39:10 | Re: TODO <-> Commitfest |