Thread

  1. Re: [BUGS] General Bug Report: Libpq function PQfnumber does not handle case-insensitive comparisons correctly

    Bruce Momjian <maillist@candle.pha.pa.us> — 1999-02-03T20:18:31Z

    Very nice.  Fix applied.
    
    
    > 
    > ============================================================================
    >                         POSTGRESQL BUG REPORT TEMPLATE
    > ============================================================================
    > 
    > 
    > Your name		: Bahman Rafatjoo
    > Your email address	: bahman@metrixsystems.com
    > 
    > Category		: runtime: front-end: C
    > Severity		: non-critical
    > 
    > Summary: Libpq function PQfnumber does not handle case-insensitive comparisons correctly
    > 
    > System Configuration
    > --------------------
    >   Operating System   : Linux 2.0.34 ELF (Slackware)
    > 
    >   PostgreSQL version : 6.4.2
    > 
    >   Compiler used      : gcc version egcs-2.90.29 980515 (egcs-1.0.3 release)
    > 
    > Hardware:
    > ---------
    > Pentium 32MB RAM
    > Linux brian 2.0.34 #5 Mon Jan 18 10:28:12 CET 1999 i586 unknown
    > 
    > Versions of other tools:
    > ------------------------
    > GNU Make version 3.76.1
    > 
    > --------------------------------------------------------------------------
    > 
    > Problem Description:
    > --------------------
    > The libpq function PQfnumber does not handle case-insensitive comparisons
    > correctly. The psql monitor converts all table and field names
    > to lower case. If the PQfnumber function is called with a mixed
    > case name, it will always return -1.
    > 
    > --------------------------------------------------------------------------
    > 
    > Test Case:
    > ----------
    > See below
    > 
    > --------------------------------------------------------------------------
    > 
    > Solution:
    > ---------
    > In the file src/interfaces/libpq/fe-exec.c edit the code for the function
    > PQfnumber. In version 1.69.2.1 of this file (which is what I have), the line
    > to be modified is line 1525. It reads:
    > 
    >     if (strcmp(field_name, res->attDescs[i].name) == 0)
    > 
    > and it should be:
    > 
    >     if (strcmp(field_case, res->attDescs[i].name) == 0)
    > 
    > 
    > 
    > 
    > --------------------------------------------------------------------------
    > 
    > 
    > 
    
    
    -- 
      Bruce Momjian                        |  http://www.op.net/~candle
      maillist@candle.pha.pa.us            |  (610) 853-3000
      +  If your life is a hard drive,     |  830 Blythe Avenue
      +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026