waiting for pg 8.4

today (2008-03-10) magnus hagander commited patch which adds new, quite handy functionality: “enum type for guc parameters".

commit message says quite a lot:

Log Message:
-----------
Implement enum type for guc parameters, and convert a couple of existing
variables to it. More need to be converted, but I wanted to get this in
before it conflicts with too much...
 
Other than just centralising the text-to-int conversion for parameters,
this allows the pg_settings view to contain a list of available options
and allows an error hint to show what values are allowed.

(copy of mail here).

what does it do?

let's see how things worked earlier (8.3):

template1=# SELECT * FROM pg_settings WHERE name = 'log_min_error_statement';
-[ RECORD 1 ]-------------------------------------------------------------------------------------------
name       | log_min_error_statement
setting    | error
unit       |
category   | Reporting AND Logging / WHEN TO Log
short_desc | Causes ALL statements generating error at OR above this level TO be logged.
extra_desc | ALL SQL statements that cause an error OF the specified level OR a higher level are logged.
context    | superuser
vartype    | string
SOURCE     | DEFAULT
min_val    |
max_val    |

this is one of configuration variables which use new enum type. as you can see we know that it contains “error" value, but we dont know what other possibilities are there.

how will that look in 8.4 ?

# SELECT * FROM pg_settings WHERE name = 'log_min_error_statement';
-[ RECORD 1 ]----------------------------------------------------------------------------------------------
name       | log_min_error_statement
setting    | error
unit       | [NULL]
category   | Reporting AND Logging / WHEN TO Log
short_desc | Causes ALL statements generating error at OR above this level TO be logged.
extra_desc | ALL SQL statements that cause an error OF the specified level OR a higher level are logged.
context    | superuser
vartype    | enum
SOURCE     | DEFAULT
min_val    | [NULL]
max_val    | [NULL]
enumvals   | debug, debug5, debug4, debug3, debug2, debug1, log, info, notice, warning, error, fatal, panic

but, what's even more important, it will also work in case when trying to set bad value.

8.3:

template1=# set log_min_error_statement = 'bad value';
ERROR:  invalid value for parameter "log_min_error_statement": "bad value"

while, in 8.4 it shows:

# set log_min_error_statement = 'bad value';
ERROR:  invalid value for parameter "log_min_error_statement": "bad value"
HINT:  Available values: debug, debug5, debug4, debug3, debug2, debug1, log, info, notice, warning, error, fatal, panic.

now, that's cool.

One thought on “waiting for pg 8.4”

  1. Yep, that’s definitely cool.

    Wonder how many years it’ll take for Oracle’s command line parser to catch up…? ;->

Comments are closed.