Thread

  1. bug with distinct?

    Alfonso Peniche <alfonso@iteso.mx> — 2001-02-10T00:23:59Z

    I dont' know if this a bug or I am just out of my mind, but since it
    works with other RDBMS's I decided to ask, so here it goes:
    
    I am trying to do the following:
    
         SELECT distinct 'mod_type' ,currval('mytable_idmytable_seq') from
    mytable;
    
    and I get the message:
    
    ERROR:  Unable to identify an ordering operator '<' for type 'unknown'
     Use an explicit ordering operator or modify the query
    
    Thinking it could be because of the currval I tried the following:
    
         SELECT distinct 'mod_type', idmytable from mytable
    
    getting the same result.
    
    Am I doing something wrong? Is there a way to do this? Is this a bug?
    
    Thanx
    
    P.S. If someone is wondering what the heck I am trying to do.... I
    pretend to insert into a log table, the mod_type for 'mytable' (in this
    case insert) and the new inserted row for 'mytable'.
    
    Cheers
    
    
    
  2. Re: bug with distinct?

    Peter Eisentraut <peter_e@gmx.net> — 2001-02-10T01:17:19Z

    Alfonso Peniche writes:
    
    >      SELECT distinct 'mod_type' ,currval('mytable_idmytable_seq') from
    > mytable;
    >
    > and I get the message:
    >
    > ERROR:  Unable to identify an ordering operator '<' for type 'unknown'
    >  Use an explicit ordering operator or modify the query
    
    Use 'mod_type'::text.
    
    -- 
    Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/
    
    
    
  3. Re: bug with distinct?

    Tom Lane <tgl@sss.pgh.pa.us> — 2001-02-10T01:23:23Z

    Alfonso Peniche <alfonso@iteso.mx> writes:
    >      SELECT distinct 'mod_type' ,currval('mytable_idmytable_seq') from
    > mytable;
    > ERROR:  Unable to identify an ordering operator '<' for type 'unknown'
    >  Use an explicit ordering operator or modify the query
    
    You need to give the literal an explicit type, eg,
    
         SELECT distinct 'mod_type'::text, currval('mytable_idmytable_seq') from
         mytable;
    
    7.1 will default to assuming that you meant 'text' in this scenario,
    but older releases are pickier.
    
    			regards, tom lane
    
    
  4. Re: bug with distinct?

    Alfonso Peniche <alfonso@iteso.mx> — 2001-02-10T17:11:14Z

    Quoting Tom Lane <tgl@sss.pgh.pa.us>:
    
    > Alfonso Peniche <alfonso@iteso.mx> writes:
    > >      SELECT distinct \'mod_type\' 
    ,currval(\'mytable_idmytable_seq\') from
    > > mytable;
    > > ERROR:  Unable to identify an ordering operator \'<\' 
    for type \'unknown\'
    > >  Use an explicit ordering operator or modify the 
    query
    >
    > You need to give the literal an explicit type, eg,
    >
    >      SELECT distinct \'mod_type\'::text, 
    currval(\'mytable_idmytable_seq\')
    > from
    >      mytable;
    >
    > 7.1 will default to assuming that you meant \'text\' in 
    this scenario,
    > but older releases are pickier.
    >
    > 			regards, tom lane
    > 
    Thanx, it woeks great now.
    
    Cheers
    
    ---