argm icon indicating copy to clipboard operation
argm copied to clipboard

Broken in PostgreSQL v10 and above

Open jeffjanes opened this issue 8 years ago • 4 comments

This extension is broken in PostgreSQL v10 and above. The queries return wrong answers, and pgxn --test check argm fails.

The breaking commit during the v10 development cycle is:

commit c82d4e658eff287846fe6243966d110ff4ae9025 Author: Tom Lane [email protected] Date: Thu Feb 2 16:38:13 2017 -0500

Fix mishandling of tSRFs at different nesting levels.

I don't really understand what about that commit causes the breakage.

jeffjanes avatar Aug 22 '18 17:08 jeffjanes

Thanks for flagging that up @jeffjanes, I'll take a look!

bashtanov avatar Aug 25 '18 17:08 bashtanov

Most probably it's just postgres' handling of set-returning functions in scalar expressions has changed:

Change the implementation of set-returning functions appearing in a query's SELECT list (Andres Freund)

Set-returning functions are now evaluated before evaluation of scalar expressions in the SELECT list, much as though they had been placed in a LATERAL FROM-clause item. This allows saner semantics for cases where multiple set-returning functions are present. If they return different numbers of rows, the shorter results are extended to match the longest result by adding nulls. Previously the results were cycled until they all terminated at the same time, producing a number of rows equal to the least common multiple of the functions' periods. In addition, set-returning functions are now disallowed within CASE and COALESCE constructs. For more information see Section 37.4.8.

I'll rewrite the tests to make them work in both pre- and post-change versions of postgres.

bashtanov avatar Aug 31 '18 15:08 bashtanov

I've opened https://github.com/bashtanov/argm/pull/8 for both parallelization and PG 10+ compatibility. @jeffjanes I would appreciate if you could have a look.

bashtanov avatar Sep 03 '18 09:09 bashtanov

Hello!

I have tested the new test codes on PostgreSQL 11.2 and it passes. Thank you for the update!

yuntingzhao avatar Apr 16 '19 22:04 yuntingzhao