Re: [HACKERS] select like...not using index
Here is what I think happened (this might be a bug, might not): Each
night I run initdb but I use a special postgresql.conf which is
optimized for quick data loading. This is copied over thedefault one
after the server is started. This contains the locale
information which
is 'initialized by initdb'. These were still 'C' because
this file was
generated before the default locale was changed. psql shows this
information when you ask it for the locale info even if it is
incorrect.I don't believe this for a minute. lc_ctype and lc_collate can *not*
be set from postgresql.conf. Try it.
It certainly doesn't. There still was a bug with the locale stuff,
though - the GUC variable was not set in the child processes. So "show
lc_collate" would *always* return "C", for example. attached patch fixes
this.
//Magnus
Attachments:
locale_guc.patchapplication/octet-stream; name=locale_guc.patchDownload+4-0
"Magnus Hagander" <mha@sollentuna.net> writes:
It certainly doesn't. There still was a bug with the locale stuff,
though - the GUC variable was not set in the child processes. So "show
lc_collate" would *always* return "C", for example. attached patch fixes
this.
Hm. Why were these vars not propagated by the regular mechanism for GUC
variables (write_nondefault_variables or whatever it's called)? If the
problem is that it's not accepting PGC_INTERNAL values, then we need to
fix it there not here, because otherwise we'll have to pass all the
PGC_INTERNAL variables through the backend_variables file, which seems
like a recipe for more of the same sort of bug.
regards, tom lane
It certainly doesn't. There still was a bug with the locale stuff,
though - the GUC variable was not set in the childprocesses. So "show
lc_collate" would *always* return "C", for example. attached
patch fixes
this.
Hm. Why were these vars not propagated by the regular
mechanism for GUC
variables (write_nondefault_variables or whatever it's called)? If the
problem is that it's not accepting PGC_INTERNAL values, then we need to
fix it there not here, because otherwise we'll have to pass all the
PGC_INTERNAL variables through the backend_variables file, which seems
like a recipe for more of the same sort of bug.
Good point :-(
I think the problem is not only that it specifically does not deal with
PGC_INTERNAL variables. The problem is in the fact that
write_nondefault_variables is called *before* the locale is read
(because the locale is read from pg_control and not from any of the
"usual" ways to read it).
Attached patch is another stab at fixing it. It makes postmaster dump a
new copy of the file once it has started the database (before it accepts
any connections), which is when it will know about these parameters.
Also updates the reading code to set the context to the one where the
variable was originally set (PGC_POSTMASTER won't work for PGC_INTERNAL,
and the other way around).
We still pass lc_collate through the special file, because
set_config_option on lc_collate will speficially *not* call setlocale(),
and we need that call. But we no longer call set_config_option from
there.
//Magnus
Attachments:
locale_guc.patchapplication/octet-stream; name=locale_guc.patchDownload+10-4
Import Notes
Resolved by subject fallback
Your patch has been added to the PostgreSQL unapplied patches list at:
http://momjian.postgresql.org/cgi-bin/pgpatches
I will try to apply it within the next 48 hours.
---------------------------------------------------------------------------
Magnus Hagander wrote:
It certainly doesn't. There still was a bug with the locale stuff,
though - the GUC variable was not set in the childprocesses. So "show
lc_collate" would *always* return "C", for example. attached
patch fixes
this.
Hm. Why were these vars not propagated by the regular
mechanism for GUC
variables (write_nondefault_variables or whatever it's called)? If the
problem is that it's not accepting PGC_INTERNAL values, then we need to
fix it there not here, because otherwise we'll have to pass all the
PGC_INTERNAL variables through the backend_variables file, which seems
like a recipe for more of the same sort of bug.Good point :-(
I think the problem is not only that it specifically does not deal with
PGC_INTERNAL variables. The problem is in the fact that
write_nondefault_variables is called *before* the locale is read
(because the locale is read from pg_control and not from any of the
"usual" ways to read it).Attached patch is another stab at fixing it. It makes postmaster dump a
new copy of the file once it has started the database (before it accepts
any connections), which is when it will know about these parameters.
Also updates the reading code to set the context to the one where the
variable was originally set (PGC_POSTMASTER won't work for PGC_INTERNAL,
and the other way around).We still pass lc_collate through the special file, because
set_config_option on lc_collate will speficially *not* call setlocale(),
and we need that call. But we no longer call set_config_option from
there.//Magnus
Content-Description: locale_guc.patch
[ Attachment, skipping... ]
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Patch applied. Thanks.
---------------------------------------------------------------------------
Magnus Hagander wrote:
It certainly doesn't. There still was a bug with the locale stuff,
though - the GUC variable was not set in the childprocesses. So "show
lc_collate" would *always* return "C", for example. attached
patch fixes
this.
Hm. Why were these vars not propagated by the regular
mechanism for GUC
variables (write_nondefault_variables or whatever it's called)? If the
problem is that it's not accepting PGC_INTERNAL values, then we need to
fix it there not here, because otherwise we'll have to pass all the
PGC_INTERNAL variables through the backend_variables file, which seems
like a recipe for more of the same sort of bug.Good point :-(
I think the problem is not only that it specifically does not deal with
PGC_INTERNAL variables. The problem is in the fact that
write_nondefault_variables is called *before* the locale is read
(because the locale is read from pg_control and not from any of the
"usual" ways to read it).Attached patch is another stab at fixing it. It makes postmaster dump a
new copy of the file once it has started the database (before it accepts
any connections), which is when it will know about these parameters.
Also updates the reading code to set the context to the one where the
variable was originally set (PGC_POSTMASTER won't work for PGC_INTERNAL,
and the other way around).We still pass lc_collate through the special file, because
set_config_option on lc_collate will speficially *not* call setlocale(),
and we need that call. But we no longer call set_config_option from
there.//Magnus
Content-Description: locale_guc.patch
[ Attachment, skipping... ]
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073