dbfiddle add tag
Erwin Brandstetter
dbfiddle.uk swallows some results. See the fiddle where I added "-- WHERE IS THE REST?":

*db<>fiddle [here](https://dbfiddle.uk/?rdbms=postgres_14&fiddle=af7f6fb70e95c0389bc0b603438ce25a)*

**Minimal test case**:  
*db<>fiddle [here](https://dbfiddle.uk/?rdbms=postgres_14&fiddle=89f166d198ea5e54bb84ae043d0d7785)*

The problem strikes when a ROW type in nested in the return type. Can be first or last or in between:  
*db<>fiddle [here](https://dbfiddle.uk/?rdbms=postgres_14&fiddle=8039b1aaf94a40cf75a7fe24b57b43b8)*

The scalar type does not matter, either:  
*db<>fiddle [here](https://dbfiddle.uk/?rdbms=postgres_14&fiddle=af8b845eb32f0d0a364ae4c7f6a2c578)*

Same result with explicit `CREATE TYPE`:  
*db<>fiddle [here](https://dbfiddle.uk/?rdbms=postgres_14&fiddle=6660216181b419fda3bc9be1acfb5610)*


What triggers the problem is the nested ROW type (= composite type).  
And it only happens the first time of asking. Subsequent calls seem to work normally.
Top Answer
Jack Douglas
I've managed to find a test case that doesn't use a function at all:

<>https://dbfiddle.uk/?rdbms=postgres_14&fiddle=e482258bcbd8c56cd394e1282baa35ed

I now think this is most likely to be a bug in libpq - I'm going to try and find a C expert to confirm :)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.