Re: row_to_json bug with index only scans: empty keys!
От | Andrew Dunstan |
---|---|
Тема | Re: row_to_json bug with index only scans: empty keys! |
Дата | |
Msg-id | 545CF0AC.9040809@dunslane.net обсуждение исходный текст |
Ответ на | row_to_json bug with index only scans: empty keys! (Ross Reedstrom <reedstrm@rice.edu>) |
Ответы |
Re: row_to_json bug with index only scans: empty keys!
Re: row_to_json bug with index only scans: empty keys! |
Список | pgsql-hackers |
On 11/07/2014 10:51 AM, Ross Reedstrom wrote: > This is a serious bug in 9.3.5 and 9.4 beta3: > > row_to_json() yields empty strings for json keys if the data is > fulfilled by an index only scan. > > Example: > > testjson=# select count(*) from document_acl; > count > ------- > 426 > (1 row) > > testjson=# SELECT row_to_json(combined_rows) FROM ( > SELECT uuid, user_id AS uid, permission > FROM document_acl_text AS acl > WHERE uuid = '8f774048-8936-4d7f-aa38-1974c91bbef2' > ORDER BY user_id ASC, permission ASC > ) as combined_rows; > row_to_json > --------------------------------------------------------------------- > {"":"8f774048-8936-4d7f-aa38-1974c91bbef2","":"admin","":"publish"} That seems odd. Here's what the relevant code does: td = DatumGetHeapTupleHeader(composite); /* Extract rowtype info and find a tupdesc */ tupType = HeapTupleHeaderGetTypeId(td); tupTypmod = HeapTupleHeaderGetTypMod(td); tupdesc = lookup_rowtype_tupdesc(tupType, tupTypmod); ... for (i = 0; i < tupdesc->natts; i++) ... attname = NameStr(tupdesc->attrs[i]->attname); escape_json(result, attname); Could this be a bug in lookup_rowtype_tupdesc()? cheers andrew
В списке pgsql-hackers по дате отправления: