why there are two TargetEntrys in Query when i use "select count(catcode) from pois group by catcode"?

From: sunpeng <bluevaley(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: why there are two TargetEntrys in Query when i use "select count(catcode) from pois group by catcode"?
Date: 2010-05-04 19:18:08
Message-ID: k2s46cc57ac1005041218n681b1608x789f5f47e965a4eb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I've the table
CREATE TABLE pois
(
uid integer not null,
name VARCHAR(128),
catcode VARCHAR(32) not null,
catname VARCHAR(32),
others VARCHAR(32)
);
after i execute "select count(*) from pois group by catcode";
the log of query.targetList is :
:targetList (
{TARGETENTRY
:expr
{AGGREF
:aggfnoid 2803
:aggtype 20
:args <>
:agglevelsup 0
:aggstar true
:aggdistinct false
:location 7
}
:resno 1
:resname count
:ressortgroupref 0
:resorigtbl 0
:resorigcol 0
:resjunk false
}
{TARGETENTRY
:expr
{VAR
:varno 1
:varattno 3
:vartype 1043
:vartypmod 36
:varlevelsup 0
:varnoold 1
:varoattno 3
:location 35
}
:resno 2
:resname <>
:ressortgroupref 1
:resorigtbl 0
:resorigcol 0
:resjunk true
}
)
why there is the second TARGETENTRY? what's the purpose of the second
TARGETENTRY?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-05-04 20:35:36 Re: why there are two TargetEntrys in Query when i use "select count(catcode) from pois group by catcode"?
Previous Message Alvaro Herrera 2010-05-04 17:48:25 Re: (psuedo) random serial for PK or at least UNIQUE NOT NULL?