pgsql: Add support for nearest-neighbor (KNN) searches to SP-GiST

2018-09-18 Thread Alexander Korotkov
Add support for nearest-neighbor (KNN) searches to SP-GiST Currently, KNN searches were supported only by GiST. SP-GiST also capable to support them. This commit implements that support. SP-GiST scan stack is replaced with queue, which serves as stack if no ordering is specified. KNN support i

pgsql: Revert "Allow concurrent-safe open() and fopen() in frontend cod

2018-09-18 Thread Tom Lane
Revert "Allow concurrent-safe open() and fopen() in frontend code for Windows" This reverts commit f02259fe93e75d5443a2fabe2f2f38b81924ab36, in the v11 branch only. The hack this required in initdb.c should probably have clued us that it wasn't really ready, but we didn't get the hint. Subsequen

pgsql: Add a debugging option to stress-test outfuncs.c and readfuncs.c

2018-09-18 Thread Tom Lane
Add a debugging option to stress-test outfuncs.c and readfuncs.c. In the normal course of operation, query trees will be serialized only if they are stored as views or rules; and plan trees will be serialized only if they get passed to parallel-query workers. This leaves an awful lot of opportuni

pgsql: Fix some minor issues exposed by outfuncs/readfuncs testing.

2018-09-18 Thread Tom Lane
Fix some minor issues exposed by outfuncs/readfuncs testing. A test patch to pass parse and plan trees through outfuncs + readfuncs exposed several issues that need to be fixed to get clean matches: Query.withCheckOptions failed to get copied; it's intentionally ignored by outfuncs/readfuncs on t

pgsql: Fix some probably-minor oversights in readfuncs.c.

2018-09-18 Thread Tom Lane
Fix some probably-minor oversights in readfuncs.c. The system expects TABLEFUNC RTEs to have coltypes, coltypmods, and colcollations lists, but outfuncs doesn't dump them and readfuncs doesn't restore them. This doesn't cause obvious failures, because the only things that look at those fields are

pgsql: Fix some probably-minor oversights in readfuncs.c.

2018-09-18 Thread Tom Lane
Fix some probably-minor oversights in readfuncs.c. The system expects TABLEFUNC RTEs to have coltypes, coltypmods, and colcollations lists, but outfuncs doesn't dump them and readfuncs doesn't restore them. This doesn't cause obvious failures, because the only things that look at those fields are

pgsql: Fix some probably-minor oversights in readfuncs.c.

2018-09-18 Thread Tom Lane
Fix some probably-minor oversights in readfuncs.c. The system expects TABLEFUNC RTEs to have coltypes, coltypmods, and colcollations lists, but outfuncs doesn't dump them and readfuncs doesn't restore them. This doesn't cause obvious failures, because the only things that look at those fields are

pgsql: Allow DSM allocation to be interrupted.

2018-09-18 Thread Thomas Munro
Allow DSM allocation to be interrupted. Chris Travers reported that the startup process can repeatedly try to cancel a backend that is in a posix_fallocate()/EINTR loop and cause it to loop forever. Teach the retry loop to give up if an interrupt is pending. Don't actually check for interrupts i

pgsql: Allow DSM allocation to be interrupted.

2018-09-18 Thread Thomas Munro
Allow DSM allocation to be interrupted. Chris Travers reported that the startup process can repeatedly try to cancel a backend that is in a posix_fallocate()/EINTR loop and cause it to loop forever. Teach the retry loop to give up if an interrupt is pending. Don't actually check for interrupts i

pgsql: Allow DSM allocation to be interrupted.

2018-09-18 Thread Thomas Munro
Allow DSM allocation to be interrupted. Chris Travers reported that the startup process can repeatedly try to cancel a backend that is in a posix_fallocate()/EINTR loop and cause it to loop forever. Teach the retry loop to give up if an interrupt is pending. Don't actually check for interrupts i

pgsql: Allow DSM allocation to be interrupted.

2018-09-18 Thread Thomas Munro
Allow DSM allocation to be interrupted. Chris Travers reported that the startup process can repeatedly try to cancel a backend that is in a posix_fallocate()/EINTR loop and cause it to loop forever. Teach the retry loop to give up if an interrupt is pending. Don't actually check for interrupts i

pgsql: Allow DSM allocation to be interrupted.

2018-09-18 Thread Thomas Munro
Allow DSM allocation to be interrupted. Chris Travers reported that the startup process can repeatedly try to cancel a backend that is in a posix_fallocate()/EINTR loop and cause it to loop forever. Teach the retry loop to give up if an interrupt is pending. Don't actually check for interrupts i

pgsql: Allow DSM allocation to be interrupted.

2018-09-18 Thread Thomas Munro
Allow DSM allocation to be interrupted. Chris Travers reported that the startup process can repeatedly try to cancel a backend that is in a posix_fallocate()/EINTR loop and cause it to loop forever. Teach the retry loop to give up if an interrupt is pending. Don't actually check for interrupts i