Re: thousands comma numeric formatting in psql - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: thousands comma numeric formatting in psql
Date
Msg-id 200507182057.j6IKvlG16410@candle.pha.pa.us
Whole thread Raw
In response to Re: thousands comma numeric formatting in psql  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
Bruce Momjian wrote:
> Tom Lane wrote:
> > Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > > OK, I have applied the following patch to make numerisep a boolean,
> >
> > "numericsep" is no longer even remotely reasonable as a name for the
> > parameter.  Something like "numeric_use_locale" would be appropriate
> > (but probably too wordy).
>
> Basically, with the C locale, it changes 1000.00 to 1,000.00, so indeed
> is does add a numeric separator.  For a European locale, 1000.00 becomes
> 1.000,00. so in that case is changes both the separator and decimal
> marker.  We don't currently have a way to display 1000.00 as 1000,00.
>
> I am thinking of calling it just numericlocale.

Done, and attached.

--
  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: doc/src/sgml/ref/psql-ref.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v
retrieving revision 1.147
diff -c -c -r1.147 psql-ref.sgml
*** doc/src/sgml/ref/psql-ref.sgml    14 Jul 2005 08:42:36 -0000    1.147
--- doc/src/sgml/ref/psql-ref.sgml    18 Jul 2005 19:38:56 -0000
***************
*** 1493,1499 ****
            </varlistentry>

            <varlistentry>
!           <term><literal>numericsep</literal></term>
            <listitem>
            <para>
            Toggles the display of a locale-aware character to separate groups
--- 1493,1499 ----
            </varlistentry>

            <varlistentry>
!           <term><literal>numericlocale</literal></term>
            <listitem>
            <para>
            Toggles the display of a locale-aware character to separate groups
Index: src/bin/psql/command.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/command.c,v
retrieving revision 1.149
diff -c -c -r1.149 command.c
*** src/bin/psql/command.c    14 Jul 2005 08:42:37 -0000    1.149
--- src/bin/psql/command.c    18 Jul 2005 19:39:02 -0000
***************
*** 1420,1435 ****
                     : _("Expanded display is off.\n"));
      }

!     /* numeric separators */
!     else if (strcmp(param, "numericsep") == 0)
      {
!         popt->topt.numericSep = !popt->topt.numericSep;
          if (!quiet)
          {
!             if (popt->topt.numericSep)
!                 puts(_("Showing numeric separators."));
              else
!                 puts(_("Numeric separators are off."));
          }
      }

--- 1420,1435 ----
                     : _("Expanded display is off.\n"));
      }

!     /* locale-aware numeric output */
!     else if (strcmp(param, "numericlocale") == 0)
      {
!         popt->topt.numericLocale = !popt->topt.numericLocale;
          if (!quiet)
          {
!             if (popt->topt.numericLocale)
!                 puts(_("Showing locale-adjusted numeric output."));
              else
!                 puts(_("Locale-adjusted numeric output is off."));
          }
      }

Index: src/bin/psql/help.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/help.c,v
retrieving revision 1.104
diff -c -c -r1.104 help.c
*** src/bin/psql/help.c    10 Jul 2005 03:46:13 -0000    1.104
--- src/bin/psql/help.c    18 Jul 2005 19:39:02 -0000
***************
*** 239,245 ****
      fprintf(output, _("  \\pset NAME [VALUE]\n"
                        "                 set table output option\n"
                        "                 (NAME := {format|border|expanded|fieldsep|footer|null|\n"
!     "                 numericsep|recordsep|tuples_only|title|tableattr|pager})\n"));
      fprintf(output, _("  \\t             show only rows (currently %s)\n"),
              ON(pset.popt.topt.tuples_only));
      fprintf(output, _("  \\T [STRING]    set HTML <table> tag attributes, or unset if none\n"));
--- 239,245 ----
      fprintf(output, _("  \\pset NAME [VALUE]\n"
                        "                 set table output option\n"
                        "                 (NAME := {format|border|expanded|fieldsep|footer|null|\n"
!     "                 numericlocale|recordsep|tuples_only|title|tableattr|pager})\n"));
      fprintf(output, _("  \\t             show only rows (currently %s)\n"),
              ON(pset.popt.topt.tuples_only));
      fprintf(output, _("  \\T [STRING]    set HTML <table> tag attributes, or unset if none\n"));
Index: src/bin/psql/print.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/print.c,v
retrieving revision 1.71
diff -c -c -r1.71 print.c
*** src/bin/psql/print.c    18 Jul 2005 19:27:37 -0000    1.71
--- src/bin/psql/print.c    18 Jul 2005 19:39:03 -0000
***************
*** 62,69 ****
      return strlen(my_str) - frac_len;
  }

  static int
! len_numericseps(const char *my_str)
  {
      int int_len = integer_digits(my_str), len = 0;
      int    groupdigits = atoi(grouping);
--- 62,70 ----
      return strlen(my_str) - frac_len;
  }

+ /* Return additional length required for locale-aware numeric output */
  static int
! additional_numeric_locale_len(const char *my_str)
  {
      int int_len = integer_digits(my_str), len = 0;
      int    groupdigits = atoi(grouping);
***************
*** 80,92 ****
  }

  static int
! len_with_numericsep(const char *my_str)
  {
!     return strlen(my_str) + len_numericseps(my_str);
  }

  static void
! format_numericsep(char *my_str)
  {
      int i, j, int_len = integer_digits(my_str), leading_digits;
      int    groupdigits = atoi(grouping);
--- 81,93 ----
  }

  static int
! strlen_with_numeric_locale(const char *my_str)
  {
!     return strlen(my_str) + additional_numeric_locale_len(my_str);
  }

  static void
! format_numeric_locale(char *my_str)
  {
      int i, j, int_len = integer_digits(my_str), leading_digits;
      int    groupdigits = atoi(grouping);
***************
*** 95,101 ****
      if (my_str[0] == '-')
          my_str++;

!     new_str = pg_local_malloc(len_with_numericsep(my_str) + 1);

      leading_digits = (int_len % groupdigits != 0) ?
                       int_len % groupdigits : groupdigits;
--- 96,102 ----
      if (my_str[0] == '-')
          my_str++;

!     new_str = pg_local_malloc(strlen_with_numeric_locale(my_str) + 1);

      leading_digits = (int_len % groupdigits != 0) ?
                       int_len % groupdigits : groupdigits;
***************
*** 143,149 ****
                       const char *const *cells, const char *const *footers,
                       const char *opt_align, const char *opt_fieldsep,
                       const char *opt_recordsep, bool opt_tuples_only,
!                      bool opt_numericsep, FILE *fout)
  {
      unsigned int col_count = 0;
      unsigned int i;
--- 144,150 ----
                       const char *const *cells, const char *const *footers,
                       const char *opt_align, const char *opt_fieldsep,
                       const char *opt_recordsep, bool opt_tuples_only,
!                      bool opt_numeric_locale, FILE *fout)
  {
      unsigned int col_count = 0;
      unsigned int i;
***************
*** 182,193 ****
              fputs(opt_recordsep, fout);
              need_recordsep = false;
          }
!         if (opt_align[i % col_count] == 'r' && opt_numericsep)
          {
!             char *my_cell = pg_local_malloc(len_with_numericsep(*ptr) + 1);

              strcpy(my_cell, *ptr);
!             format_numericsep(my_cell);
              fputs(my_cell, fout);
              free(my_cell);
          }
--- 183,194 ----
              fputs(opt_recordsep, fout);
              need_recordsep = false;
          }
!         if (opt_align[i % col_count] == 'r' && opt_numeric_locale)
          {
!             char *my_cell = pg_local_malloc(strlen_with_numeric_locale(*ptr) + 1);

              strcpy(my_cell, *ptr);
!             format_numeric_locale(my_cell);
              fputs(my_cell, fout);
              free(my_cell);
          }
***************
*** 227,233 ****
                           const char *const *cells,
                           const char *const *footers, const char *opt_align,
                           const char *opt_fieldsep, const char *opt_recordsep,
!                          bool opt_tuples_only, bool opt_numericsep, FILE *fout)
  {
      unsigned int col_count = 0;
      unsigned int i;
--- 228,234 ----
                           const char *const *cells,
                           const char *const *footers, const char *opt_align,
                           const char *opt_fieldsep, const char *opt_recordsep,
!                          bool opt_tuples_only, bool opt_numeric_locale, FILE *fout)
  {
      unsigned int col_count = 0;
      unsigned int i;
***************
*** 258,269 ****

          fputs(headers[i % col_count], fout);
          fputs(opt_fieldsep, fout);
!         if (opt_align[i % col_count] == 'r' && opt_numericsep)
          {
!             char *my_cell = pg_local_malloc(len_with_numericsep(*ptr) + 1);

              strcpy(my_cell, *ptr);
!             format_numericsep(my_cell);
              fputs(my_cell, fout);
              free(my_cell);
          }
--- 259,270 ----

          fputs(headers[i % col_count], fout);
          fputs(opt_fieldsep, fout);
!         if (opt_align[i % col_count] == 'r' && opt_numeric_locale)
          {
!             char *my_cell = pg_local_malloc(strlen_with_numeric_locale(*ptr) + 1);

              strcpy(my_cell, *ptr);
!             format_numeric_locale(my_cell);
              fputs(my_cell, fout);
              free(my_cell);
          }
***************
*** 331,337 ****
  static void
  print_aligned_text(const char *title, const char *const *headers,
                     const char *const *cells, const char *const *footers,
!                    const char *opt_align, bool opt_tuples_only, bool opt_numericsep,
                     unsigned short int opt_border, int encoding,
                     FILE *fout)
  {
--- 332,338 ----
  static void
  print_aligned_text(const char *title, const char *const *headers,
                     const char *const *cells, const char *const *footers,
!                    const char *opt_align, bool opt_tuples_only, bool opt_numeric_locale,
                     unsigned short int opt_border, int encoding,
                     FILE *fout)
  {
***************
*** 398,411 ****

      for (i = 0, ptr = cells; *ptr; ptr++, i++)
      {
!         int numericseps;

!         if (opt_align[i % col_count] == 'r' && opt_numericsep)
!             numericseps = len_numericseps(*ptr);
          else
!             numericseps = 0;

!         tmp = pg_wcswidth((unsigned char *) *ptr, strlen(*ptr), encoding) + numericseps;
          if (tmp > widths[i % col_count])
              widths[i % col_count] = tmp;
          cell_w[i] = tmp;
--- 399,412 ----

      for (i = 0, ptr = cells; *ptr; ptr++, i++)
      {
!         int numeric_locale_len;

!         if (opt_align[i % col_count] == 'r' && opt_numeric_locale)
!             numeric_locale_len = additional_numeric_locale_len(*ptr);
          else
!             numeric_locale_len = 0;

!         tmp = pg_wcswidth((unsigned char *) *ptr, strlen(*ptr), encoding) + numeric_locale_len;
          if (tmp > widths[i % col_count])
              widths[i % col_count] = tmp;
          cell_w[i] = tmp;
***************
*** 485,496 ****
          /* content */
          if (opt_align[i % col_count] == 'r')
          {
!             if (opt_numericsep)
              {
                  char *my_cell = pg_local_malloc(cell_w[i] + 1);

                  strcpy(my_cell, *ptr);
!                 format_numericsep(my_cell);
                  fprintf(fout, "%*s%s", widths[i % col_count] - cell_w[i], "", my_cell);
                  free(my_cell);
              }
--- 486,497 ----
          /* content */
          if (opt_align[i % col_count] == 'r')
          {
!             if (opt_numeric_locale)
              {
                  char *my_cell = pg_local_malloc(cell_w[i] + 1);

                  strcpy(my_cell, *ptr);
!                 format_numeric_locale(my_cell);
                  fprintf(fout, "%*s%s", widths[i % col_count] - cell_w[i], "", my_cell);
                  free(my_cell);
              }
***************
*** 552,558 ****
  print_aligned_vertical(const char *title, const char *const *headers,
                         const char *const *cells, const char *const *footers,
                         const char *opt_align, bool opt_tuples_only,
!                        bool opt_numericsep, unsigned short int opt_border,
                         int encoding, FILE *fout)
  {
      unsigned int col_count = 0;
--- 553,559 ----
  print_aligned_vertical(const char *title, const char *const *headers,
                         const char *const *cells, const char *const *footers,
                         const char *opt_align, bool opt_tuples_only,
!                        bool opt_numeric_locale, unsigned short int opt_border,
                         int encoding, FILE *fout)
  {
      unsigned int col_count = 0;
***************
*** 615,628 ****
      /* find longest data cell */
      for (i = 0, ptr = cells; *ptr; ptr++, i++)
      {
!         int numericseps;

!         if (opt_align[i % col_count] == 'r' && opt_numericsep)
!             numericseps = len_numericseps(*ptr);
          else
!             numericseps = 0;

!         tmp = pg_wcswidth((unsigned char *) *ptr, strlen(*ptr), encoding) + numericseps;
          if (tmp > dwidth)
              dwidth = tmp;
          cell_w[i] = tmp;
--- 616,629 ----
      /* find longest data cell */
      for (i = 0, ptr = cells; *ptr; ptr++, i++)
      {
!         int numeric_locale_len;

!         if (opt_align[i % col_count] == 'r' && opt_numeric_locale)
!             numeric_locale_len = additional_numeric_locale_len(*ptr);
          else
!             numeric_locale_len = 0;

!         tmp = pg_wcswidth((unsigned char *) *ptr, strlen(*ptr), encoding) + numeric_locale_len;
          if (tmp > dwidth)
              dwidth = tmp;
          cell_w[i] = tmp;
***************
*** 700,707 ****
              char *my_cell = pg_local_malloc(cell_w[i] + 1);

              strcpy(my_cell, *ptr);
!             if (opt_align[i % col_count] == 'r' && opt_numericsep)
!                 format_numericsep(my_cell);
              if (opt_border < 2)
                  puts(my_cell);
              else
--- 701,708 ----
              char *my_cell = pg_local_malloc(cell_w[i] + 1);

              strcpy(my_cell, *ptr);
!             if (opt_align[i % col_count] == 'r' && opt_numeric_locale)
!                 format_numeric_locale(my_cell);
              if (opt_border < 2)
                  puts(my_cell);
              else
***************
*** 788,794 ****
  print_html_text(const char *title, const char *const *headers,
                  const char *const *cells, const char *const *footers,
                  const char *opt_align, bool opt_tuples_only,
!                 bool opt_numericsep, unsigned short int opt_border,
                  const char *opt_table_attr, FILE *fout)
  {
      unsigned int col_count = 0;
--- 789,795 ----
  print_html_text(const char *title, const char *const *headers,
                  const char *const *cells, const char *const *footers,
                  const char *opt_align, bool opt_tuples_only,
!                 bool opt_numeric_locale, unsigned short int opt_border,
                  const char *opt_table_attr, FILE *fout)
  {
      unsigned int col_count = 0;
***************
*** 834,845 ****
          /* is string only whitespace? */
          if ((*ptr)[strspn(*ptr, " \t")] == '\0')
              fputs("  ", fout);
!         else if (opt_align[i % col_count] == 'r' && opt_numericsep)
          {
!             char *my_cell = pg_local_malloc(len_with_numericsep(*ptr) + 1);

              strcpy(my_cell, *ptr);
!             format_numericsep(my_cell);
              html_escaped_print(my_cell, fout);
              free(my_cell);
          }
--- 835,846 ----
          /* is string only whitespace? */
          if ((*ptr)[strspn(*ptr, " \t")] == '\0')
              fputs("  ", fout);
!         else if (opt_align[i % col_count] == 'r' && opt_numeric_locale)
          {
!             char *my_cell = pg_local_malloc(strlen_with_numeric_locale(*ptr) + 1);

              strcpy(my_cell, *ptr);
!             format_numeric_locale(my_cell);
              html_escaped_print(my_cell, fout);
              free(my_cell);
          }
***************
*** 875,881 ****
  print_html_vertical(const char *title, const char *const *headers,
                    const char *const *cells, const char *const *footers,
                    const char *opt_align, bool opt_tuples_only,
!                   bool opt_numericsep, unsigned short int opt_border,
                    const char *opt_table_attr, FILE *fout)
  {
      unsigned int col_count = 0;
--- 876,882 ----
  print_html_vertical(const char *title, const char *const *headers,
                    const char *const *cells, const char *const *footers,
                    const char *opt_align, bool opt_tuples_only,
!                   bool opt_numeric_locale, unsigned short int opt_border,
                    const char *opt_table_attr, FILE *fout)
  {
      unsigned int col_count = 0;
***************
*** 919,930 ****
          /* is string only whitespace? */
          if ((*ptr)[strspn(*ptr, " \t")] == '\0')
              fputs("  ", fout);
!         else if (opt_align[i % col_count] == 'r' && opt_numericsep)
          {
!             char *my_cell = pg_local_malloc(len_with_numericsep(*ptr) + 1);

              strcpy(my_cell, *ptr);
!             format_numericsep(my_cell);
              html_escaped_print(my_cell, fout);
              free(my_cell);
          }
--- 920,931 ----
          /* is string only whitespace? */
          if ((*ptr)[strspn(*ptr, " \t")] == '\0')
              fputs("  ", fout);
!         else if (opt_align[i % col_count] == 'r' && opt_numeric_locale)
          {
!             char *my_cell = pg_local_malloc(strlen_with_numeric_locale(*ptr) + 1);

              strcpy(my_cell, *ptr);
!             format_numeric_locale(my_cell);
              html_escaped_print(my_cell, fout);
              free(my_cell);
          }
***************
*** 1000,1006 ****
  print_latex_text(const char *title, const char *const *headers,
                   const char *const *cells, const char *const *footers,
                   const char *opt_align, bool opt_tuples_only,
!                  bool opt_numericsep, unsigned short int opt_border,
                   FILE *fout)
  {
      unsigned int col_count = 0;
--- 1001,1007 ----
  print_latex_text(const char *title, const char *const *headers,
                   const char *const *cells, const char *const *footers,
                   const char *opt_align, bool opt_tuples_only,
!                  bool opt_numeric_locale, unsigned short int opt_border,
                   FILE *fout)
  {
      unsigned int col_count = 0;
***************
*** 1061,1072 ****
      /* print cells */
      for (i = 0, ptr = cells; *ptr; i++, ptr++)
      {
!         if (opt_numericsep)
          {
!             char *my_cell = pg_local_malloc(len_with_numericsep(*ptr) + 1);

              strcpy(my_cell, *ptr);
!             format_numericsep(my_cell);
              latex_escaped_print(my_cell, fout);
              free(my_cell);
          }
--- 1062,1073 ----
      /* print cells */
      for (i = 0, ptr = cells; *ptr; i++, ptr++)
      {
!         if (opt_numeric_locale)
          {
!             char *my_cell = pg_local_malloc(strlen_with_numeric_locale(*ptr) + 1);

              strcpy(my_cell, *ptr);
!             format_numeric_locale(my_cell);
              latex_escaped_print(my_cell, fout);
              free(my_cell);
          }
***************
*** 1103,1109 ****
  print_latex_vertical(const char *title, const char *const *headers,
                    const char *const *cells, const char *const *footers,
                    const char *opt_align, bool opt_tuples_only,
!                   bool opt_numericsep, unsigned short int opt_border,
                    FILE *fout)
  {
      unsigned int col_count = 0;
--- 1104,1110 ----
  print_latex_vertical(const char *title, const char *const *headers,
                    const char *const *cells, const char *const *footers,
                    const char *opt_align, bool opt_tuples_only,
!                   bool opt_numeric_locale, unsigned short int opt_border,
                    FILE *fout)
  {
      unsigned int col_count = 0;
***************
*** 1174,1185 ****
      if (footers && !opt_tuples_only)
          for (ptr = footers; *ptr; ptr++)
          {
!             if (opt_numericsep)
              {
!                 char *my_cell = pg_local_malloc(len_with_numericsep(*ptr) + 1);

                  strcpy(my_cell, *ptr);
!                 format_numericsep(my_cell);
                  latex_escaped_print(my_cell, fout);
                  free(my_cell);
              }
--- 1175,1186 ----
      if (footers && !opt_tuples_only)
          for (ptr = footers; *ptr; ptr++)
          {
!             if (opt_numeric_locale)
              {
!                 char *my_cell = pg_local_malloc(strlen_with_numeric_locale(*ptr) + 1);

                  strcpy(my_cell, *ptr);
!                 format_numeric_locale(my_cell);
                  latex_escaped_print(my_cell, fout);
                  free(my_cell);
              }
***************
*** 1220,1226 ****
  print_troff_ms_text(const char *title, const char *const *headers,
                   const char *const *cells, const char *const *footers,
                   const char *opt_align, bool opt_tuples_only,
!                  bool opt_numericsep, unsigned short int opt_border,
                   FILE *fout)
  {
      unsigned int col_count = 0;
--- 1221,1227 ----
  print_troff_ms_text(const char *title, const char *const *headers,
                   const char *const *cells, const char *const *footers,
                   const char *opt_align, bool opt_tuples_only,
!                  bool opt_numeric_locale, unsigned short int opt_border,
                   FILE *fout)
  {
      unsigned int col_count = 0;
***************
*** 1274,1285 ****
      /* print cells */
      for (i = 0, ptr = cells; *ptr; i++, ptr++)
      {
!         if (opt_numericsep)
          {
!             char *my_cell = pg_local_malloc(len_with_numericsep(*ptr) + 1);

              strcpy(my_cell, *ptr);
!             format_numericsep(my_cell);
              troff_ms_escaped_print(my_cell, fout);
              free(my_cell);
          }
--- 1275,1286 ----
      /* print cells */
      for (i = 0, ptr = cells; *ptr; i++, ptr++)
      {
!         if (opt_numeric_locale)
          {
!             char *my_cell = pg_local_malloc(strlen_with_numeric_locale(*ptr) + 1);

              strcpy(my_cell, *ptr);
!             format_numeric_locale(my_cell);
              troff_ms_escaped_print(my_cell, fout);
              free(my_cell);
          }
***************
*** 1313,1319 ****
  print_troff_ms_vertical(const char *title, const char *const *headers,
                    const char *const *cells, const char *const *footers,
                    const char *opt_align, bool opt_tuples_only,
!                   bool opt_numericsep, unsigned short int opt_border,
                    FILE *fout)
  {
      unsigned int col_count = 0;
--- 1314,1320 ----
  print_troff_ms_vertical(const char *title, const char *const *headers,
                    const char *const *cells, const char *const *footers,
                    const char *opt_align, bool opt_tuples_only,
!                   bool opt_numeric_locale, unsigned short int opt_border,
                    FILE *fout)
  {
      unsigned int col_count = 0;
***************
*** 1386,1397 ****

          troff_ms_escaped_print(headers[i % col_count], fout);
          fputc('\t', fout);
!         if (opt_numericsep)
          {
!             char *my_cell = pg_local_malloc(len_with_numericsep(*ptr) + 1);

              strcpy(my_cell, *ptr);
!             format_numericsep(my_cell);
              troff_ms_escaped_print(my_cell, fout);
              free(my_cell);
          }
--- 1387,1398 ----

          troff_ms_escaped_print(headers[i % col_count], fout);
          fputc('\t', fout);
!         if (opt_numeric_locale)
          {
!             char *my_cell = pg_local_malloc(strlen_with_numeric_locale(*ptr) + 1);

              strcpy(my_cell, *ptr);
!             format_numeric_locale(my_cell);
              troff_ms_escaped_print(my_cell, fout);
              free(my_cell);
          }
***************
*** 1533,1539 ****
      /* print the stuff */

      if (flog)
!         print_aligned_text(title, headers, cells, footers, align, opt->tuples_only, opt->numericSep, border,
opt->encoding,flog); 

      switch (opt->format)
      {
--- 1534,1540 ----
      /* print the stuff */

      if (flog)
!         print_aligned_text(title, headers, cells, footers, align, opt->tuples_only, opt->numericLocale, border,
opt->encoding,flog); 

      switch (opt->format)
      {
***************
*** 1541,1590 ****
              if (use_expanded)
                  print_unaligned_vertical(title, headers, cells, footers, align,
                                           opt->fieldSep, opt->recordSep,
!                                          opt->tuples_only, opt->numericSep, output);
              else
                  print_unaligned_text(title, headers, cells, footers, align,
                                       opt->fieldSep, opt->recordSep,
!                                      opt->tuples_only, opt->numericSep, output);
              break;
          case PRINT_ALIGNED:
              if (use_expanded)
                  print_aligned_vertical(title, headers, cells, footers, align,
!                                        opt->tuples_only, opt->numericSep, border,
                                         opt->encoding, output);
              else
                  print_aligned_text(title, headers, cells, footers, align,
!                                    opt->tuples_only, opt->numericSep,
                                     border, opt->encoding, output);
              break;
          case PRINT_HTML:
              if (use_expanded)
                  print_html_vertical(title, headers, cells, footers, align,
!                                     opt->tuples_only, opt->numericSep,
                                      border, opt->tableAttr, output);
              else
                  print_html_text(title, headers, cells, footers,
!                                 align, opt->tuples_only, opt->numericSep, border,
                                  opt->tableAttr, output);
              break;
          case PRINT_LATEX:
              if (use_expanded)
                  print_latex_vertical(title, headers, cells, footers, align,
!                                      opt->tuples_only, opt->numericSep,
                                       border, output);
              else
                  print_latex_text(title, headers, cells, footers, align,
!                                  opt->tuples_only, opt->numericSep,
                                   border, output);
              break;
          case PRINT_TROFF_MS:
              if (use_expanded)
                  print_troff_ms_vertical(title, headers, cells, footers, align,
!                                         opt->tuples_only, opt->numericSep,
                                          border, output);
              else
                  print_troff_ms_text(title, headers, cells, footers, align,
!                                     opt->tuples_only, opt->numericSep,
                                      border, output);
              break;
          default:
--- 1542,1591 ----
              if (use_expanded)
                  print_unaligned_vertical(title, headers, cells, footers, align,
                                           opt->fieldSep, opt->recordSep,
!                                          opt->tuples_only, opt->numericLocale, output);
              else
                  print_unaligned_text(title, headers, cells, footers, align,
                                       opt->fieldSep, opt->recordSep,
!                                      opt->tuples_only, opt->numericLocale, output);
              break;
          case PRINT_ALIGNED:
              if (use_expanded)
                  print_aligned_vertical(title, headers, cells, footers, align,
!                                        opt->tuples_only, opt->numericLocale, border,
                                         opt->encoding, output);
              else
                  print_aligned_text(title, headers, cells, footers, align,
!                                    opt->tuples_only, opt->numericLocale,
                                     border, opt->encoding, output);
              break;
          case PRINT_HTML:
              if (use_expanded)
                  print_html_vertical(title, headers, cells, footers, align,
!                                     opt->tuples_only, opt->numericLocale,
                                      border, opt->tableAttr, output);
              else
                  print_html_text(title, headers, cells, footers,
!                                 align, opt->tuples_only, opt->numericLocale, border,
                                  opt->tableAttr, output);
              break;
          case PRINT_LATEX:
              if (use_expanded)
                  print_latex_vertical(title, headers, cells, footers, align,
!                                      opt->tuples_only, opt->numericLocale,
                                       border, output);
              else
                  print_latex_text(title, headers, cells, footers, align,
!                                  opt->tuples_only, opt->numericLocale,
                                   border, output);
              break;
          case PRINT_TROFF_MS:
              if (use_expanded)
                  print_troff_ms_vertical(title, headers, cells, footers, align,
!                                         opt->tuples_only, opt->numericLocale,
                                          border, output);
              else
                  print_troff_ms_text(title, headers, cells, footers, align,
!                                     opt->tuples_only, opt->numericLocale,
                                      border, output);
              break;
          default:
Index: src/bin/psql/print.h
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/print.h,v
retrieving revision 1.27
diff -c -c -r1.27 print.h
*** src/bin/psql/print.h    14 Jul 2005 08:42:37 -0000    1.27
--- src/bin/psql/print.h    18 Jul 2005 19:39:03 -0000
***************
*** 40,46 ****
      char       *fieldSep;        /* field separator for unaligned text mode */
      char       *recordSep;        /* record separator for unaligned text
                                   * mode */
!     bool        numericSep;        /* locale-aware numeric units separator and
                                   *  decimal marker */
      char       *tableAttr;        /* attributes for HTML <table ...> */
      int            encoding;        /* character encoding */
--- 40,46 ----
      char       *fieldSep;        /* field separator for unaligned text mode */
      char       *recordSep;        /* record separator for unaligned text
                                   * mode */
!     bool        numericLocale;    /* locale-aware numeric units separator and
                                   *  decimal marker */
      char       *tableAttr;        /* attributes for HTML <table ...> */
      int            encoding;        /* character encoding */

pgsql-patches by date:

Previous
From: "Rocco Altier"
Date:
Subject: Re: Changes for AIX buildfarm
Next
From: "Titus von Boxberg"
Date:
Subject: Re: PL/PGSQL: Dynamic Record Introspection