Re: Should enum GUCs be listed as such in config.sgml?

Поиск
Список
Период
Сортировка
Искать

Re: Should enum GUCs be listed as such in config.sgml?

От:
Bruce Momjian <bruce@momjian.us>
Дата:
bruce wrote:
> Tom Lane wrote:
> > Currently, config.sgml still describes the new "enum" GUC variables
> > as being of type "string" --- but pg_settings says they are "enum".
> > This is not very consistent, but I wonder whether changing the docs
> > would be more confusing or less so.  I note that section 18.1 doesn't
> > mention the enum alternative either.
> 
> I looked into this and I think the documentation is fine.  If enums
> didn't require quotes but strings did, we would document them
> differently, but the fact is that enums are the same as strings except
> enums have a limited number of possible values --- that isn't something
> that is usually identified in a variable type definition heading.

Looking further, it seems we still have an inconsistency problem because
pg_settings mentions enum;  should we just change that to 'string'?

--  Bruce Momjian          http://momjian.us EnterpriseDB                             http://enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +

Re: Should enum GUCs be listed as such in config.sgml?

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Bruce Momjian  writes:
> bruce wrote:
>> Tom Lane wrote:
>>> Currently, config.sgml still describes the new "enum" GUC variables
>>> as being of type "string" --- but pg_settings says they are "enum".
>>> This is not very consistent, but I wonder whether changing the docs
>>> would be more confusing or less so.  I note that section 18.1 doesn't
>>> mention the enum alternative either.
>> 
>> I looked into this and I think the documentation is fine.  If enums
>> didn't require quotes but strings did, we would document them
>> differently, but the fact is that enums are the same as strings except
>> enums have a limited number of possible values --- that isn't something
>> that is usually identified in a variable type definition heading.

By that logic, we should not distinguish integers and floats.  One's
just a restricted form of the other.

> Looking further, it seems we still have an inconsistency problem because
> pg_settings mentions enum;  should we just change that to 'string'?

No, and in fact pg_settings is the counterexample to your conclusion
that it's okay to pretend enums are the same as strings: since it has an
enumvals column that's populated for enums and not for strings, there
is clearly a genuine user-visible difference.


Last I checked, Magnus had promised to come up with suitable
documentation changes for this patch, but then he went off sailing...
		regards, tom lane

Re: Should enum GUCs be listed as such in config.sgml?

От:
Magnus Hagander <magnus@hagander.net>
Дата:
Tom Lane wrote:
> Bruce Momjian  writes:
>> bruce wrote:
>>> Tom Lane wrote:
>>>> Currently, config.sgml still describes the new "enum" GUC variables
>>>> as being of type "string" --- but pg_settings says they are "enum".
>>>> This is not very consistent, but I wonder whether changing the docs
>>>> would be more confusing or less so.  I note that section 18.1 doesn't
>>>> mention the enum alternative either.
>>> I looked into this and I think the documentation is fine.  If enums
>>> didn't require quotes but strings did, we would document them
>>> differently, but the fact is that enums are the same as strings except
>>> enums have a limited number of possible values --- that isn't something
>>> that is usually identified in a variable type definition heading.
> 
> By that logic, we should not distinguish integers and floats.  One's
> just a restricted form of the other.
> 
>> Looking further, it seems we still have an inconsistency problem because
>> pg_settings mentions enum;  should we just change that to 'string'?
> 
> No, and in fact pg_settings is the counterexample to your conclusion
> that it's okay to pretend enums are the same as strings: since it has an
> enumvals column that's populated for enums and not for strings, there
> is clearly a genuine user-visible difference.
> 
> 
> Last I checked, Magnus had promised to come up with suitable
> documentation changes for this patch, but then he went off sailing...

Yes, it's on my TODO list waiting to bubble up to the top. Not forgotten
(yet).

//Magnus


Re: Should enum GUCs be listed as such in config.sgml?

От:
Magnus Hagander <magnus@hagander.net>
Дата:
Tom Lane wrote:
> Bruce Momjian  writes:
>> bruce wrote:
>>> Tom Lane wrote:
>>>> Currently, config.sgml still describes the new "enum" GUC variables
>>>> as being of type "string" --- but pg_settings says they are "enum".
>>>> This is not very consistent, but I wonder whether changing the docs
>>>> would be more confusing or less so.  I note that section 18.1 doesn't
>>>> mention the enum alternative either.
>>> I looked into this and I think the documentation is fine.  If enums
>>> didn't require quotes but strings did, we would document them
>>> differently, but the fact is that enums are the same as strings except
>>> enums have a limited number of possible values --- that isn't something
>>> that is usually identified in a variable type definition heading.
> 
> By that logic, we should not distinguish integers and floats.  One's
> just a restricted form of the other.
> 
>> Looking further, it seems we still have an inconsistency problem because
>> pg_settings mentions enum;  should we just change that to 'string'?
> 
> No, and in fact pg_settings is the counterexample to your conclusion
> that it's okay to pretend enums are the same as strings: since it has an
> enumvals column that's populated for enums and not for strings, there
> is clearly a genuine user-visible difference.
> 
> 
> Last I checked, Magnus had promised to come up with suitable
> documentation changes for this patch, but then he went off sailing...

Meh, I seem to have forgotten this one again. Here's a suggestion, seems
ok, or were you thinking about something more?

//Magnus
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index b0de16e..1cfa8bc 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -20,8 +20,8 @@
 
    
     All parameter names are case-insensitive. Every parameter takes a
-    value of one of four types: Boolean, integer, floating point,
-    or string. Boolean values can be written as ON,
+    value of one of five types: Boolean, integer, floating point,
+    string or enum. Boolean values can be written as ON,
     OFF, TRUE,
     FALSE, YES,
     NO, 1, 0
@@ -43,6 +43,12 @@
    
 
    
+    Enum settings are specified the same way as string settings, but they
+    are limited in which strings are accepted. For each setting the available
+    are listed in pg_settings.enumvals</>.
+   
+
+   
     One way to set these parameters is to edit the file
     postgresql.conf</>postgresql.conf</></>,
     which is normally kept in the data directory. (initdb</>
@@ -1329,7 +1335,7 @@ SET ENABLE_SEQSCAN TO OFF;
      
      
      
-      wal_sync_method (string)
+      wal_sync_method (enum)
       
        wal_sync_method</> configuration parameter
       
@@ -2464,7 +2470,7 @@ local0.*    /var/log/postgresql
      
 
      
-      syslog_facility (string)
+      syslog_facility (enum)
       
        syslog_facility</> configuration parameter
       
@@ -2511,7 +2517,7 @@ local0.*    /var/log/postgresql
      
 
      
-      client_min_messages (string)
+      client_min_messages (enum)
       
        client_min_messages</> configuration parameter
       
@@ -2532,7 +2538,7 @@ local0.*    /var/log/postgresql
      
 
      
-      log_min_messages (string)
+      log_min_messages (enum)
       
        log_min_messages</> configuration parameter
       
@@ -2554,7 +2560,7 @@ local0.*    /var/log/postgresql
      
 
      
-      log_error_verbosity (string)
+      log_error_verbosity (enum)
       
        log_error_verbosity</> configuration parameter
       
@@ -2570,7 +2576,7 @@ local0.*    /var/log/postgresql
      
 
      
-      log_min_error_statement (string)
+      log_min_error_statement (enum)
       
        log_min_error_statement</> configuration parameter
       
@@ -3056,7 +3062,7 @@ local0.*    /var/log/postgresql
      
 
      
-      log_statement (string)
+      log_statement (enum)
       
        log_statement</> configuration parameter
       
@@ -3314,7 +3320,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
      
 
      
-      track_functions (string)
+      track_functions (enum)
       
        track_functions</> configuration parameter
       
@@ -3828,7 +3834,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
       
        default_transaction_isolation</> configuration parameter
       
-      default_transaction_isolation (string)
+      default_transaction_isolation (enum)
       
        
         Each SQL transaction has an isolation level, which can be
@@ -3871,7 +3877,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
      
 
      
-      session_replication_role (string)
+      session_replication_role (enum)
       
        session_replication_role</> configuration parameter
       
@@ -3933,7 +3939,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
      
 
      
-      xmlbinary (string)
+      xmlbinary (enum)
       
        xmlbinary</> configuration parameter
       
@@ -3960,7 +3966,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
      
 
      
-      xmloption (string)
+      xmloption (enum)
       
        xmloption</> configuration parameter
       
@@ -4026,7 +4032,7 @@ SET XML OPTION { DOCUMENT | CONTENT };
      
 
      
-      IntervalStyle (string)
+      IntervalStyle (enum)
       
        IntervalStyle</> configuration parameter
       
@@ -4514,7 +4520,7 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
      
 
      
-      backslash_quote (string)
+      backslash_quote (enum)
       strings</>backslash quotes</></>
       
        backslash_quote</> configuration parameter
@@ -4602,7 +4608,7 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
      
 
      
-      regex_flavor (string)
+      regex_flavor (enum)
       regular expressions</></>
       
        regex_flavor</> configuration parameter

Re: Should enum GUCs be listed as such in config.sgml?

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Magnus Hagander  writes:
> Tom Lane wrote:
>> Last I checked, Magnus had promised to come up with suitable
>> documentation changes for this patch, but then he went off sailing...

> Meh, I seem to have forgotten this one again. Here's a suggestion, seems
> ok, or were you thinking about something more?

Needs a bit of proofreading but this is more or less what I had in
mind.

> +    Enum settings are specified the same way as string settings, but they
> +    are limited in which strings are accepted. For each setting the available
> +    are listed in pg_settings.enumvals</>.

IIRC the comparisons are case-insensitive; if so the fact should be
mentioned here.
		regards, tom lane

Re: Should enum GUCs be listed as such in config.sgml?

От:
Magnus Hagander <magnus@hagander.net>
Дата:
Tom Lane wrote:
> Magnus Hagander  writes:
>> Tom Lane wrote:
>>> Last I checked, Magnus had promised to come up with suitable
>>> documentation changes for this patch, but then he went off sailing...
> 
>> Meh, I seem to have forgotten this one again. Here's a suggestion, seems
>> ok, or were you thinking about something more?
> 
> Needs a bit of proofreading but this is more or less what I had in
> mind.
> 
>> +    Enum settings are specified the same way as string settings, but they
>> +    are limited in which strings are accepted. For each setting the available
>> +    are listed in pg_settings.enumvals</>.
> 
> IIRC the comparisons are case-insensitive; if so the fact should be
> mentioned here.

Updated, added, and applied.

//Magnus


FAQ