Re: Another small bug (pg_autovacuum)

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Another small bug (pg_autovacuum)
Дата
Msg-id 200309101957.h8AJvlH27895@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: Another small bug (pg_autovacuum)  ("Matthew T. O'Connor" <matthew@zeut.net>)
Ответы Re: Another small bug (pg_autovacuum)  ("Matthew T. O'Connor" <matthew@zeut.net>)
Список pgsql-hackers
I assume the attached patch is what you want done to fix this.  Applied.

It quotes table names for vacuum and analyze, and uppercases the
keywords for clarity.

---------------------------------------------------------------------------

Matthew T. O'Connor wrote:
> Ouch... sorry, my fault.  I'll fix this tomorrow (Friday) and submit a
> patch, or if you want to submit a patch that would be fine.  All you
> have to do is change the the sql statements to put quotes around the
> relation name.
>
> Thanks for catching this.
>
> Matthew T. O'Connor
>
> On Thu, 2003-09-04 at 18:39, Adam Kavan wrote:
> > Now that I have pg_autovacuum working I've bumped into another small
> > bug.  When pg_autovacuum goes to vacuum or analyze one of my tables it runs...
> >
> > analyze public.ConfigBackup
> >
> > Because ConfigBackup is mixed case it cannot find the relation.  I fixed
> > this by going to the function init_table_info and increasing the malloc for
> > new_tbl->table_name by 2 and adding "'s to either side of the table
> > name.  Is there anything wrong with this approach?  Is there a config I can
> > set to make this non-case sensitive?
> >
> > Thanks again for your time.
> >
> > --- Adam Kavan
> > --- akavan@cox.net
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> >                http://www.postgresql.org/docs/faqs/FAQ.html
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match
>

--
  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
Index: contrib/pg_autovacuum/pg_autovacuum.c
===================================================================
RCS file: /cvsroot/pgsql-server/contrib/pg_autovacuum/pg_autovacuum.c,v
retrieving revision 1.3
diff -c -c -r1.3 pg_autovacuum.c
*** contrib/pg_autovacuum/pg_autovacuum.c    4 Aug 2003 00:43:11 -0000    1.3
--- contrib/pg_autovacuum/pg_autovacuum.c    10 Sep 2003 19:57:15 -0000
***************
*** 581,587 ****
      {
          PGresult   *res = NULL;

!         res = send_query("vacuum", dbi);
          /* FIXME: Perhaps should add a check for PQ_COMMAND_OK */
          PQclear(res);
          return 1;
--- 581,587 ----
      {
          PGresult   *res = NULL;

!         res = send_query("VACUUM", dbi);
          /* FIXME: Perhaps should add a check for PQ_COMMAND_OK */
          PQclear(res);
          return 1;
***************
*** 733,739 ****
      PGresult   *res = NULL;
      int            ret = 0;

!     res = send_query("show stats_row_level", dbi);
      ret =
          strcmp("on", PQgetvalue(res, 0, PQfnumber(res, "stats_row_level")));
      PQclear(res);
--- 733,739 ----
      PGresult   *res = NULL;
      int            ret = 0;

!     res = send_query("SHOW stats_row_level", dbi);
      ret =
          strcmp("on", PQgetvalue(res, 0, PQfnumber(res, "stats_row_level")));
      PQclear(res);
***************
*** 1082,1088 ****
                                   */
                                  if ((tbl->curr_vacuum_count - tbl->CountAtLastVacuum) >= tbl->vacuum_threshold)
                                  {
!                                     snprintf(buf, sizeof(buf), "vacuum analyze %s", tbl->table_name);
                                      if (args->debug >= 1)
                                      {
                                          sprintf(logbuffer, "Performing: %s", buf);
--- 1082,1088 ----
                                   */
                                  if ((tbl->curr_vacuum_count - tbl->CountAtLastVacuum) >= tbl->vacuum_threshold)
                                  {
!                                     snprintf(buf, sizeof(buf), "VACUUM ANALYZE \"%s\"", tbl->table_name);
                                      if (args->debug >= 1)
                                      {
                                          sprintf(logbuffer, "Performing: %s", buf);
***************
*** 1096,1102 ****
                                  }
                                  else if ((tbl->curr_analyze_count - tbl->CountAtLastAnalyze) >=
tbl->analyze_threshold)
                                  {
!                                     snprintf(buf, sizeof(buf), "analyze %s", tbl->table_name);
                                      if (args->debug >= 1)
                                      {
                                          sprintf(logbuffer, "Performing: %s", buf);
--- 1096,1102 ----
                                  }
                                  else if ((tbl->curr_analyze_count - tbl->CountAtLastAnalyze) >=
tbl->analyze_threshold)
                                  {
!                                     snprintf(buf, sizeof(buf), "ANALYZE \"%s\"", tbl->table_name);
                                      if (args->debug >= 1)
                                      {
                                          sprintf(logbuffer, "Performing: %s", buf);

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [BUGS] pg_dump/all doesn't output schemas correctly (v7.3.4)
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: Broken(?) 'interval' problems. [Was: ISO 8601 "Time Intervals"]