Skip to content

Commit

Permalink
developments for postgresql v14 (#104)
Browse files Browse the repository at this point in the history
* Fix prompt_for_password() against PostgreSQL v14 Beta1

This patch handles the change of PostgreSQL core's
67a472d7. It corresponds the change of simple_prompt() interface
and removes arbitrary restrictions on password length.

* Rename from appendStringInfoVA() to appendStringInfoVA_c()

PostgreSQL core code has the same function name, but the
implementation is not same. So, rename from appendStringInfoVA()
to appendStringInfoVA_c().

* Fix the wrong return type of *WriterInsertProc

* Reuse the RelationSetNewRelfilenode's definition for v14 beta1

* Fix pg_getmessage arguments against PostgreSQL v14 Beta1

This patch handles the changes of PostgreSQL core's
9626325d. It adds heuristic incoming-message-size
limits in the server.

* Fix the wrong arguments types of functions

Fix TupleParserInit() and TupleParseDumpRecord()

* Fix EState struct againt PostgreSQL v14 Beta1

This patch handles the following PostgreSQL core's changes.

1. The patch(1375422c) removes es_result_relations and
es_num_result_relations to simplify things.

2. The patch(a04daa97) removes es_result_relation_info
to improve maintainability.

* Fix argments of reindex_index() againt PostgreSQL v14 Beta1

To handle the PostgreSQL's patch(a3dc9260), which refactors
option handling of REINDEX.

* Update nbtsort.c against PostgreSQL v14 Beta1

* Update test codes for PostgreSQL v14 Beta1

* Update the github action workflow for PostgreSQL14 Beta1
  • Loading branch information
mikecaat authored Jun 11, 2021
1 parent 49bdead commit d3f699a
Show file tree
Hide file tree
Showing 12 changed files with 2,163 additions and 27 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
strategy:
matrix:
PGVERSION: # TODO: build with master branch
- 14beta1
- 13.2
- 12.6
- 11.11
Expand Down
24 changes: 18 additions & 6 deletions bin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ sql/init-12.sql:
cp sql/init-extension-v2.sql sql/init-12.sql
sql/init-13.sql:
cp sql/init-extension-v2.sql sql/init-13.sql
sql/init-14.sql:
cp sql/init-extension-v2.sql sql/init-14.sql

sql/load_bin.sql: sql/load_bin-$(MAJORVERSION).sql
cp sql/load_bin-$(MAJORVERSION).sql sql/load_bin.sql
Expand All @@ -81,6 +83,8 @@ sql/load_bin-12.sql:
cp sql/load_bin-v2.sql sql/load_bin-12.sql
sql/load_bin-13.sql:
cp sql/load_bin-v2.sql sql/load_bin-13.sql
sql/load_bin-14.sql:
cp sql/load_bin-v2.sql sql/load_bin-14.sql

sql/load_csv.sql: sql/load_csv-$(MAJORVERSION).sql
cp sql/load_csv-$(MAJORVERSION).sql sql/load_csv.sql
Expand All @@ -100,6 +104,8 @@ sql/load_csv-12.sql:
cp sql/load_csv-v2.sql sql/load_csv-12.sql
sql/load_csv-13.sql:
cp sql/load_csv-v2.sql sql/load_csv-13.sql
sql/load_csv-14.sql:
cp sql/load_csv-v2.sql sql/load_csv-14.sql

sql/load_filter.sql: sql/load_filter-$(MAJORVERSION).sql
cp sql/load_filter-$(MAJORVERSION).sql sql/load_filter.sql
Expand All @@ -119,6 +125,8 @@ sql/load_filter-12.sql:
cp sql/load_filter-v3.sql sql/load_filter-12.sql
sql/load_filter-13.sql:
cp sql/load_filter-v3.sql sql/load_filter-13.sql
sql/load_filter-14.sql:
cp sql/load_filter-v3.sql sql/load_filter-14.sql

sql/load_function.sql: sql/load_function-$(MAJORVERSION).sql
cp sql/load_function-$(MAJORVERSION).sql sql/load_function.sql
Expand All @@ -138,6 +146,8 @@ sql/load_function-12.sql:
cp sql/load_function-v3.sql sql/load_function-12.sql
sql/load_function-13.sql:
cp sql/load_function-v3.sql sql/load_function-13.sql
sql/load_function-14.sql:
cp sql/load_function-v3.sql sql/load_function-14.sql

sql/write_bin.sql: sql/write_bin-$(MAJORVERSION).sql
cp sql/write_bin-$(MAJORVERSION).sql sql/write_bin.sql
Expand All @@ -157,18 +167,20 @@ sql/write_bin-12.sql:
cp sql/write_bin-v1.sql sql/write_bin-12.sql
sql/write_bin-13.sql:
cp sql/write_bin-v2.sql sql/write_bin-13.sql
sql/write_bin-14.sql:
cp sql/write_bin-v2.sql sql/write_bin-14.sql


.PHONY: subclean
clean: subclean

subclean:
rm -f sql/init.sql sql/init-{9.3,9.4,9.5,9.6,10,11,12,13}.sql
rm -f sql/load_bin.sql sql/load_bin-{9.3,9.4,9.5,9.6,10,11,12,13}.sql
rm -f sql/load_csv.sql sql/load_csv-{9.3,9.4,9.5,9.6,10,11,12,13}.sql
rm -f sql/load_filter.sql sql/load_filter-{9.3,9.4,9.5,9.6,10,11,12,13}.sql
rm -f sql/load_function.sql sql/load_function-{9.3,9.4,9.5,9.6,10,11,12,13}.sql
rm -f sql/write_bin.sql sql/write_bin-{9.3,9.4,9.5,9.6,10,11,12,13}.sql
rm -f sql/init.sql sql/init-{9.3,9.4,9.5,9.6,10,11,12,13,14}.sql
rm -f sql/load_bin.sql sql/load_bin-{9.3,9.4,9.5,9.6,10,11,12,13,14}.sql
rm -f sql/load_csv.sql sql/load_csv-{9.3,9.4,9.5,9.6,10,11,12,13,14}.sql
rm -f sql/load_filter.sql sql/load_filter-{9.3,9.4,9.5,9.6,10,11,12,13,14}.sql
rm -f sql/load_function.sql sql/load_function-{9.3,9.4,9.5,9.6,10,11,12,13,14}.sql
rm -f sql/write_bin.sql sql/write_bin-{9.3,9.4,9.5,9.6,10,11,12,13,14}.sql

installcheck: sql/init.sql sql/load_bin.sql sql/load_csv.sql sql/load_function.sql sql/load_filter.sql sql/write_bin.sql

Expand Down
17 changes: 12 additions & 5 deletions bin/pgut/pgut.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
*/

#include "postgres_fe.h"
#if PG_VERSION_NUM >= 140000
#include "common/string.h"
#endif
#include "libpq/pqsignal.h"

#include <limits.h>
Expand Down Expand Up @@ -387,7 +390,11 @@ parse_time(const char *value, time_t *time)

static char *
prompt_for_password(void)
#if PG_VERSION_NUM >= 100000
#if PG_VERSION_NUM >= 140000
{
return simple_prompt("Password: ", false);
}
#elif PG_VERSION_NUM >= 100000
{
char buf[100];

Expand Down Expand Up @@ -837,7 +844,7 @@ elog(int elevel, const char *fmt, ...)
do
{
va_start(args, fmt);
ok = appendStringInfoVA(&edata->msg, fmt, args);
ok = appendStringInfoVA_c(&edata->msg, fmt, args);
va_end(args);
} while (!ok);
len = strlen(fmt);
Expand Down Expand Up @@ -1002,7 +1009,7 @@ errmsg(const char *fmt,...)
do
{
va_start(args, fmt);
ok = appendStringInfoVA(&edata->msg, fmt, args);
ok = appendStringInfoVA_c(&edata->msg, fmt, args);
va_end(args);
} while (!ok);
len = strlen(fmt);
Expand All @@ -1023,7 +1030,7 @@ errdetail(const char *fmt,...)
do
{
va_start(args, fmt);
ok = appendStringInfoVA(&edata->detail, fmt, args);
ok = appendStringInfoVA_c(&edata->detail, fmt, args);
va_end(args);
} while (!ok);
trimStringBuffer(&edata->detail);
Expand Down Expand Up @@ -1209,7 +1216,7 @@ exit_or_abort(int exitcode)
* unlike the server code, this function automatically extend the buffer.
*/
bool
appendStringInfoVA(StringInfo str, const char *fmt, va_list args)
appendStringInfoVA_c(StringInfo str, const char *fmt, va_list args)
{
size_t avail;
int nprinted;
Expand Down
2 changes: 1 addition & 1 deletion bin/pgut/pgut.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ extern void CHECK_FOR_INTERRUPTS(void);
#define appendStringInfoChar appendPQExpBufferChar
#define appendBinaryStringInfo appendBinaryPQExpBuffer

extern bool appendStringInfoVA(StringInfo str, const char *fmt, va_list args)
extern bool appendStringInfoVA_c(StringInfo str, const char *fmt, va_list args)
__attribute__((format(PG_BULKLOAD_PRINTF_ATTRIBUTE, 2, 0)));
extern int appendStringInfoFile(StringInfo str, FILE *fp);
extern int appendStringInfoFd(StringInfo str, int fd);
Expand Down
2 changes: 1 addition & 1 deletion include/writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ typedef struct WriterResult
} WriterResult;

typedef void (*WriterInitProc)(Writer *self);
typedef bool (*WriterInsertProc)(Writer *self, HeapTuple tuple);
typedef void (*WriterInsertProc)(Writer *self, HeapTuple tuple);
typedef WriterResult (*WriterCloseProc)(Writer *self, bool onError);
typedef bool (*WriterParamProc)(Writer *self, const char *keyword, char *value);
typedef void (*WriterDumpParamsProc)(Writer *self);
Expand Down
Loading

0 comments on commit d3f699a

Please sign in to comment.