Folks,

I just ran across an issue where in psql, people can get the line
number in the file so long as it is under 2^32-1 lines long, but once
it gets larger than that, it's hosed.

This patch changes the data type from unsigned int to unsigned long
long, which is probably not the correct thing in order to get 64-bit
arithmetic, but I figure it's good enough to get a discussion started.

Cheers,
D
-- 
David Fetter <[EMAIL PROTECTED]> http://fetter.org/
phone: +1 415 235 3778        AIM: dfetter666
                              Skype: davidfetter

Remember to vote!
Index: src/bin/psql/common.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/common.c,v
retrieving revision 1.122
diff -c -r1.122 common.c
*** src/bin/psql/common.c       14 Jul 2006 14:52:26 -0000      1.122
--- src/bin/psql/common.c       30 Jul 2006 21:08:39 -0000
***************
*** 188,194 ****
                fflush(pset.queryFout);
  
        if (pset.inputfile)
!               fprintf(stderr, "%s:%s:%u: ", pset.progname, pset.inputfile, 
pset.lineno);
        va_start(ap, fmt);
        vfprintf(stderr, _(fmt), ap);
        va_end(ap);
--- 188,194 ----
                fflush(pset.queryFout);
  
        if (pset.inputfile)
!               fprintf(stderr, "%s:%s:%lld: ", pset.progname, pset.inputfile, 
pset.lineno);
        va_start(ap, fmt);
        vfprintf(stderr, _(fmt), ap);
        va_end(ap);
Index: src/bin/psql/mainloop.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/mainloop.c,v
retrieving revision 1.81
diff -c -r1.81 mainloop.c
*** src/bin/psql/mainloop.c     14 Jul 2006 14:52:26 -0000      1.81
--- src/bin/psql/mainloop.c     30 Jul 2006 21:08:40 -0000
***************
*** 44,50 ****
        /* Save the prior command source */
        FILE       *prev_cmd_source;
        bool            prev_cmd_interactive;
!       unsigned int prev_lineno;
  
        /* Save old settings */
        prev_cmd_source = pset.cur_cmd_source;
--- 44,50 ----
        /* Save the prior command source */
        FILE       *prev_cmd_source;
        bool            prev_cmd_interactive;
!       unsigned long long prev_lineno;
  
        /* Save old settings */
        prev_cmd_source = pset.cur_cmd_source;
Index: src/bin/psql/settings.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/settings.h,v
retrieving revision 1.27
diff -c -r1.27 settings.h
*** src/bin/psql/settings.h     5 Mar 2006 15:58:52 -0000       1.27
--- src/bin/psql/settings.h     30 Jul 2006 21:08:40 -0000
***************
*** 50,56 ****
        char       *inputfile;          /* for error reporting */
        char       *dirname;            /* current directory for \s display */
  
!       unsigned        lineno;                 /* also for error reporting */
  
        bool            timing;                 /* enable timing of all queries 
*/
  
--- 50,56 ----
        char       *inputfile;          /* for error reporting */
        char       *dirname;            /* current directory for \s display */
  
!       unsigned long long      lineno; /* also for error reporting */
  
        bool            timing;                 /* enable timing of all queries 
*/
  
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to