OSDN Git Service

Dept of second thoughts: don't try to push LIMIT below a SRF.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 18 Nov 2010 16:53:49 +0000 (11:53 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 18 Nov 2010 16:54:34 +0000 (11:54 -0500)
commit48c348f86ce09c668af7cf271757c3f156f28344
treeea8223183f60b7a8bdd0171dbd22df4c02c09408
parent1fc2d60d8c9d8096373e94a8f8c9b28d2082b7d3
Dept of second thoughts: don't try to push LIMIT below a SRF.

If we have Limit->Result->Sort, the Result might be projecting a tlist
that contains a set-returning function.  If so, it's possible for the
SRF to sometimes return zero rows, which means we could need to fetch
more than N rows from the Sort in order to satisfy LIMIT N.
So top-N sorting cannot be used in this scenario.
src/backend/executor/nodeLimit.c