Skip site navigation (1) Skip section navigation (2)

Re: Recent updates

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: lockhart(at)alumnus(dot)caltech(dot)edu (Thomas G(dot) Lockhart)
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: Recent updates
Date: 1998-07-15 16:31:24
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
> > What does 'select null order by 1;' do now?
> postgres=> select null order by 1;
> ERROR:  type id lookup of 0 failed
> Darn. That doesn't touch the UNION code, so will need to look elsewhere
> I guess.
> > I have renamed the append struct names just now as part of an EXPLAIN
> > fix.  Should not affect you.
> OK.
>                     - Tom

It is from here:
	#2  0x9aca9 in typeidType (id=0) at parse_type.c:69
	#3  0x99d19 in oper (opname=0x8ce13 "<", ltypeId=0, rtypeId=0, 
	    noWarnings=0 '\000') at parse_oper.c:614
	#4  0x95a18 in transformSortClause (pstate=0x129f50, orderlist=0x130650, 
	    sortlist=0x0, targetlist=0x130690, uniqueFlag=0x0) at parse_clause.c:330
	#5  0x7daed in transformSelectStmt (pstate=0x129f50, stmt=0x2dfb90)
	    at analyze.c:802
	#6  0x7cb99 in transformStmt (pstate=0x129f50, parseTree=0x2dfb90)
	    at analyze.c:190
	#7  0x7c91c in parse_analyze (pl=0x130670, parentParseState=0x0)
	    at analyze.c:76

Looks easy to fix.  The code is:

    /* check for exact match on this operator... */
    if (HeapTupleIsValid(tup = oper_exact(opname, ltypeId, rtypeId, NULL, NULL,$
    /* try to find a match on likely candidates... */
    else if (HeapTupleIsValid(tup = oper_inexact(opname, ltypeId, rtypeId, NULL$
    else if (!noWarnings)
        elog(ERROR, "Unable to find binary operator '%s' for types %s and %s",
             opname, typeTypeName(typeidType(ltypeId)), typeTypeName(typeidType$

It can't find operators for NULL, and is bombing when trying to print
the error message.  I think we need to handle this query properly,
because some sql's generated by other programs will auto-order by all
the fields.  I think your fix that you did with sort perhaps can be done

But actually, the call is coming from transformSortClause(), so parhaps
you can do a NULL test there and prevent oper() from even being called.

Glad you are back on-line.

Bruce Momjian                          |  830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

In response to


pgsql-hackers by date

Next:From: Andreas ZeugswetterDate: 1998-07-15 16:39:09
Subject: AW: [HACKERS] "internal error" triggered by EXISTS()
Previous:From: Thomas G. LockhartDate: 1998-07-15 16:26:29
Subject: Re: Recent updates

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group