[COMMITTERS] pgsql: Fix pg_file_write() error handling.

2017-03-12 Thread Noah Misch
Fix pg_file_write() error handling. Detect fclose() failures; given "ln -s /dev/full $PGDATA/devfull", "pg_file_write('devfull', 'x', true)" now fails as it should. Don't leak a stream when fwrite() fails. Remove a born-ineffective test that aimed to skip zero-length writes. Back-patch to 9.2 (

[COMMITTERS] pgsql: Fix pg_file_write() error handling.

2017-03-12 Thread Noah Misch
Fix pg_file_write() error handling. Detect fclose() failures; given "ln -s /dev/full $PGDATA/devfull", "pg_file_write('devfull', 'x', true)" now fails as it should. Don't leak a stream when fwrite() fails. Remove a born-ineffective test that aimed to skip zero-length writes. Back-patch to 9.2 (

[COMMITTERS] pgsql: Fix pg_file_write() error handling.

2017-03-12 Thread Noah Misch
Fix pg_file_write() error handling. Detect fclose() failures; given "ln -s /dev/full $PGDATA/devfull", "pg_file_write('devfull', 'x', true)" now fails as it should. Don't leak a stream when fwrite() fails. Remove a born-ineffective test that aimed to skip zero-length writes. Back-patch to 9.2 (

[COMMITTERS] pgsql: Use wrappers of PG_DETOAST_DATUM_PACKED() more.

2017-03-12 Thread Noah Misch
Use wrappers of PG_DETOAST_DATUM_PACKED() more. This makes almost all core code follow the policy introduced in the previous commit. Specific decisions: - Text search support functions with char* and length arguments, such as prsstart and lexize, may receive unaligned strings. I doubt maint

[COMMITTERS] pgsql: Fix pg_file_write() error handling.

2017-03-12 Thread Noah Misch
Fix pg_file_write() error handling. Detect fclose() failures; given "ln -s /dev/full $PGDATA/devfull", "pg_file_write('devfull', 'x', true)" now fails as it should. Don't leak a stream when fwrite() fails. Remove a born-ineffective test that aimed to skip zero-length writes. Back-patch to 9.2 (

[COMMITTERS] pgsql: Fix comment about length of text, bytea, etc.

2017-03-12 Thread Noah Misch
Fix comment about length of text, bytea, etc. When commit 3e23b68dac006e8deb0afa327e855258df8de064 introduced single-byte varlena headers, it rendered this comment incomplete. Branch -- master Details --- http://git.postgresql.org/pg/commitdiff/9e0926468a1c41a31c09785787a737311dcd92c1 M

[COMMITTERS] pgsql: Assume deconstruct_array() outputs are untoasted.

2017-03-12 Thread Noah Misch
Assume deconstruct_array() outputs are untoasted. In functions that issue a deconstruct_array() call, consistently use plain VARSIZE()/VARDATA() on the array elements. Prior practice was divided between those and VARSIZE_ANY_EXHDR()/VARDATA_ANY(). Branch -- master Details --- http://git

[COMMITTERS] pgsql: Fix pg_file_write() error handling.

2017-03-12 Thread Noah Misch
Fix pg_file_write() error handling. Detect fclose() failures; given "ln -s /dev/full $PGDATA/devfull", "pg_file_write('devfull', 'x', true)" now fails as it should. Don't leak a stream when fwrite() fails. Remove a born-ineffective test that aimed to skip zero-length writes. Back-patch to 9.2 (

[COMMITTERS] pgsql: Recommend wrappers of PG_DETOAST_DATUM_PACKED().

2017-03-12 Thread Noah Misch
Recommend wrappers of PG_DETOAST_DATUM_PACKED(). When commit 3e23b68dac006e8deb0afa327e855258df8de064 introduced single-byte varlena headers, its fmgr.h changes presented PG_GETARG_TEXT_PP() and PG_GETARG_TEXT_P() as equals. Its postgres.h changes presented PG_DETOAST_DATUM_PACKED() and VARDATA_A

[COMMITTERS] pgsql: Fix pg_file_write() error handling.

2017-03-12 Thread Noah Misch
Fix pg_file_write() error handling. Detect fclose() failures; given "ln -s /dev/full $PGDATA/devfull", "pg_file_write('devfull', 'x', true)" now fails as it should. Don't leak a stream when fwrite() fails. Remove a born-ineffective test that aimed to skip zero-length writes. Back-patch to 9.2 (

Re: [COMMITTERS] pgsql: dblink: Replace some macros by static functions

2017-03-12 Thread David Rowley
On 11 March 2017 at 03:46, Peter Eisentraut wrote: > dblink: Replace some macros by static functions > > Also remove some unused code and the no longer useful dblink.h file. > > Reviewed-by: Tsunakawa, Takayuki > > Branch > -- > master > > Details > --- > http://git.postgresql.org/pg/com

[COMMITTERS] pgsql: Add "break"s to make it clearer what will happen in a nested swi

2017-03-12 Thread Tom Lane
Add "break"s to make it clearer what will happen in a nested switch. This could only matter if the guessed_type variable had a value that wasn't a member of the PasswordType enum; but just in case, let's be sure that control falls out to reach the elog(ERROR) at the end of the function. Per gripe

[COMMITTERS] pgsql: Fix typo in initdb's SCRAM password processing.

2017-03-12 Thread Tom Lane
Fix typo in initdb's SCRAM password processing. Noted by Coverity (a rather impressive catch). Michael Paquier Branch -- master Details --- http://git.postgresql.org/pg/commitdiff/835cc1136745e8cf02d3d0231b5b7c7a543df5df Modified Files -- src/bin/initdb/initdb.c | 2 +- 1 fi

[COMMITTERS] pgsql: Remove dead code in nodeGatherMerge.c.

2017-03-12 Thread Tom Lane
Remove dead code in nodeGatherMerge.c. Coverity noted that the last line of gather_merge_getnext() was unreachable, since each arm of the preceding "if" ends in a "return". Drop it as an oversight. In passing, improve some nearby comments. Branch -- master Details --- http://git.postgre