Coder Social home page Coder Social logo

postgres_osm_pbf_fdw's People

Contributors

vpikulik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

postgres_osm_pbf_fdw's Issues

Postgres 9.6?

Hi. Thanks for this extension. Is it or planned to be compatible with Postgres 9.6?

PostgreSQL 15 support

Hi,

v15 is 2 weeks away. osm_fdw does not build against v15. Can you pleae take a look? Thanks!

/usr/lib64/ccache/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2  -Isrc/osm_reader -DPGV= -I. -I./ -I/usr/pgsql-15/include/server -I/usr/pgsql-15/include/internal  -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include -flto=thin -emit-llvm -c -o src/osm_reader/type_defs.bc src/osm_reader/type_defs.c
/usr/lib64/ccache/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2  -Isrc/osm_reader -DPGV= -I. -I./ -I/usr/pgsql-15/include/server -I/usr/pgsql-15/include/internal  -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include -flto=thin -emit-llvm -c -o src/osm_reader/zdecode.bc src/osm_reader/zdecode.c
src/osm_reader/zdecode.c: In function 'append_data':
src/osm_reader/zdecode.c:19:23: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
   19 |     memcpy(data->data + data->size, in, size);
      |                       ^
src/osm_reader/zdecode.c: At top level:
src/osm_reader/zdecode.c:23:16: warning: no previous prototype for 'init_resized_buffer' [-Wmissing-prototypes]
   23 | ResizedBuffer* init_resized_buffer() {
      |                ^~~~~~~~~~~~~~~~~~~
src/osm_reader/zdecode.c: In function 'zdecode':
src/osm_reader/zdecode.c:51:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   51 |     ResizedBuffer *result = init_resized_buffer();
      |     ^~~~~~~~~~~~~
/usr/lib64/ccache/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2  -Isrc/osm_reader -DPGV= -I. -I./ -I/usr/pgsql-15/include/server -I/usr/pgsql-15/include/internal  -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include -flto=thin -emit-llvm -c -o src/osm_fdw/jsonb_encode.bc src/osm_fdw/jsonb_encode.c
src/osm_reader/type_defs.c:5:6: warning: no previous prototype for 'free_tag' [-Wmissing-prototypes]
    5 | void free_tag(OsmTag* tag) {
      |      ^~~~~~~~
src/osm_reader/type_defs.c:11:6: warning: no previous prototype for 'free_member' [-Wmissing-prototypes]
   11 | void free_member(OsmMember* member) {
      |      ^~~~~~~~~~~
src/osm_reader/type_defs.c:16:10: warning: no previous prototype for 'init_item' [-Wmissing-prototypes]
   16 | OsmItem* init_item() {
      |          ^~~~~~~~~
src/osm_reader/type_defs.c:92:9: warning: no previous prototype for 'alloc_cursor' [-Wmissing-prototypes]
   92 | Cursor* alloc_cursor() {
      |         ^~~~~~~~~~~~
/usr/lib64/ccache/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2  -Isrc/osm_reader -DPGV= -I. -I./ -I/usr/pgsql-15/include/server -I/usr/pgsql-15/include/internal  -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include -flto=thin -emit-llvm -c -o src/osm_fdw/osm_fdw.bc src/osm_fdw/osm_fdw.c
src/osm_fdw/jsonb_encode.c:5:13: warning: no previous prototype for 'make_jsonb_string_value' [-Wmissing-prototypes]
    5 | JsonbValue* make_jsonb_string_value(char* string) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~
src/osm_fdw/jsonb_encode.c:15:13: warning: no previous prototype for 'make_jsonb_numeric_value' [-Wmissing-prototypes]
   15 | JsonbValue* make_jsonb_numeric_value(double value) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~~
src/osm_fdw/jsonb_encode.c: In function 'make_jsonb_numeric_value':
src/osm_fdw/jsonb_encode.c:18:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   18 |     Datum d_num_value = Float8GetDatum(value);
      |     ^~~~~
src/osm_fdw/jsonb_encode.c: At top level:
src/osm_fdw/jsonb_encode.c:26:13: warning: no previous prototype for 'make_jsonb_array' [-Wmissing-prototypes]
   26 | JsonbValue* make_jsonb_array(int elems_count, JsonbValue **elems) {
      |             ^~~~~~~~~~~~~~~~
src/osm_fdw/jsonb_encode.c: In function 'make_jsonb_array':
src/osm_fdw/jsonb_encode.c:30:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   30 |     int i;
      |     ^~~
src/osm_fdw/jsonb_encode.c: At top level:
src/osm_fdw/jsonb_encode.c:40:13: warning: no previous prototype for 'make_jsonb_object' [-Wmissing-prototypes]
   40 | JsonbValue* make_jsonb_object(int elems_count, JsonbValue **keys, JsonbValue **values) {
      |             ^~~~~~~~~~~~~~~~~
src/osm_fdw/jsonb_encode.c: In function 'make_jsonb_object':
src/osm_fdw/jsonb_encode.c:44:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   44 |     int i;
      |     ^~~
src/osm_fdw/jsonb_encode.c: In function 'jsonb_encode_tags':
src/osm_fdw/jsonb_encode.c:67:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   67 |     JsonbValue *jtags = make_jsonb_object(item->tags_count, jkeys, jvalues);
      |     ^~~~~~~~~~
src/osm_fdw/jsonb_encode.c: In function 'jsonb_encode_member':
src/osm_fdw/jsonb_encode.c:90:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   90 |     JsonbValue *jmember = make_jsonb_object(3, jkeys, jvalues);
      |     ^~~~~~~~~~
src/osm_fdw/jsonb_encode.c: In function 'jsonb_encode_members':
src/osm_fdw/jsonb_encode.c:104:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  104 |     JsonbValue *jmembers = make_jsonb_array(item->members_count, jvalues);
      |     ^~~~~~~~~~
In function 'jsonb_encode_member',
    inlined from 'jsonb_encode_members' at src/osm_fdw/jsonb_encode.c:102:22:
src/osm_fdw/jsonb_encode.c:86:18: warning: 'member_type_name' may be used uninitialized [-Wmaybe-uninitialized]
   86 |     jvalues[1] = make_jsonb_string_value(member_type_name);
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/osm_fdw/jsonb_encode.c: In function 'jsonb_encode_members':
src/osm_fdw/jsonb_encode.c:78:11: note: 'member_type_name' was declared here
   78 |     char* member_type_name;
      |           ^~~~~~~~~~~~~~~~
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -Isrc/osm_reader -DPGV= -I. -I./ -I/usr/pgsql-15/include/server -I/usr/pgsql-15/include/internal  -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o src/osm_reader/fileformat.pb-c.o src/osm_reader/fileformat.pb-c.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -Isrc/osm_reader -DPGV= -I. -I./ -I/usr/pgsql-15/include/server -I/usr/pgsql-15/include/internal  -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o src/osm_reader/osmformat.pb-c.o src/osm_reader/osmformat.pb-c.c
/usr/lib64/ccache/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2  -Isrc/osm_reader -DPGV= -I. -I./ -I/usr/pgsql-15/include/server -I/usr/pgsql-15/include/internal  -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include -flto=thin -emit-llvm -c -o src/osm_reader/fileformat.pb-c.bc src/osm_reader/fileformat.pb-c.c
src/osm_reader/osm_reader.c: In function 'read_blob_header':
src/osm_reader/osm_reader.c:8:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    8 |     OSMPBF__BlobHeader *header;
      |     ^~~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_blob':
src/osm_reader/osm_reader.c:18:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   18 |     OSMPBF__Blob* blob = osmpbf__blob__unpack(NULL, header->datasize, buf);
      |     ^~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_osm_string_table':
src/osm_reader/osm_reader.c:44:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   44 |     char** strings = malloc(sizeof(char*) * stringtable->n_s);
      |     ^~~~
src/osm_reader/osm_reader.c: At top level:
src/osm_reader/osm_reader.c:65:8: warning: no previous prototype for 'get_lat' [-Wmissing-prototypes]
   65 | double get_lat(int64_t lat, OSMPBF__PrimitiveBlock* primitive_block){
      |        ^~~~~~~
src/osm_reader/osm_reader.c:82:8: warning: no previous prototype for 'get_lon' [-Wmissing-prototypes]
   82 | double get_lon(int64_t lon, OSMPBF__PrimitiveBlock* primitive_block){
      |        ^~~~~~~
src/osm_reader/osm_reader.c:99:8: warning: no previous prototype for 'get_timestamp' [-Wmissing-prototypes]
   99 | double get_timestamp(int64_t timestamp, OSMPBF__PrimitiveBlock* primitive_block) {
      |        ^~~~~~~~~~~~~
src/osm_reader/osm_reader.c:110:6: warning: no previous prototype for 'read_osm_dense_info' [-Wmissing-prototypes]
  110 | void read_osm_dense_info(OsmItem **items, OSMPBF__DenseInfo *info, char** strings, OSMPBF__PrimitiveBlock *primitive_block) {
      |      ^~~~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_osm_dense_nodes':
src/osm_reader/osm_reader.c:142:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  142 |     OsmItem **items = malloc(sizeof(OsmItem*) * dense->n_id);
      |     ^~~~~~~
src/osm_reader/osm_reader.c:152:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  152 |         OsmItem *item = init_item();
      |         ^~~~~~~
src/osm_reader/osm_reader.c:162:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  162 |     int item_index = 0;
      |     ^~~
src/osm_reader/osm_reader.c:171:13: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  171 |             OsmTag* tag = (OsmTag*)malloc(sizeof(OsmTag));
      |             ^~~~~~
src/osm_reader/osm_reader.c: At top level:
src/osm_reader/osm_reader.c:184:6: warning: no previous prototype for 'read_osm_info' [-Wmissing-prototypes]
  184 | void read_osm_info(OSMPBF__Info *info, char** strings, OsmItem* item, OSMPBF__PrimitiveBlock* primitive_block) {
      |      ^~~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_osm_way':
src/osm_reader/osm_reader.c:214:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  214 |     int32_t key_index, val_index;
      |     ^~~~~~~
src/osm_reader/osm_reader.c:219:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  219 |         OsmTag* tag = (OsmTag*)malloc(sizeof(OsmTag));
      |         ^~~~~~
src/osm_reader/osm_reader.c: In function 'read_osm_relation':
src/osm_reader/osm_reader.c:238:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  238 |     int32_t key_index, val_index;
      |     ^~~~~~~
src/osm_reader/osm_reader.c:243:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  243 |         OsmTag* tag = (OsmTag*)malloc(sizeof(OsmTag));
      |         ^~~~~~
src/osm_reader/osm_reader.c:249:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  249 |     int64_t member_id = 0;
      |     ^~~~~~~
src/osm_reader/osm_reader.c:252:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  252 |         OsmMember *member = (OsmMember*)malloc(sizeof(OsmMember));
      |         ^~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_osm_primitive_block':
src/osm_reader/osm_reader.c:291:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  291 |     int i;
      |     ^~~
src/osm_reader/osm_reader.c: At top level:
src/osm_reader/osm_reader.c:299:8: warning: no previous prototype for '_read_header_size' [-Wmissing-prototypes]
  299 | size_t _read_header_size(FILE* file) {
      |        ^~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function '_read_header_size':
src/osm_reader/osm_reader.c:302:12: warning: implicit declaration of function 'ntohl' [-Wimplicit-function-declaration]
  302 |     return ntohl(header_size);
      |            ^~~~~
src/osm_reader/osm_reader.c: At top level:
src/osm_reader/osm_reader.c:306:6: warning: no previous prototype for '_load_data_from_file' [-Wmissing-prototypes]
  306 | void _load_data_from_file(Cursor* cursor, FILE* file, short read_header) {
      |      ^~~~~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c:333:11: warning: no previous prototype for 'check_eof' [-Wmissing-prototypes]
  333 | short int check_eof(FILE* file, file_size_t file_size) {
      |           ^~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_blob_header':
src/osm_reader/osm_reader.c:7:5: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     fread(buf, header_size, 1, file);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_blob':
src/osm_reader/osm_reader.c:17:5: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     fread(buf, header->datasize, 1, file);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | };
      | ^
src/osm_reader/osm_reader.c: In function '_read_header_size':
src/osm_reader/osm_reader.c:301:5: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result]
  301 |     fread(&header_size, 4, 1, file);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_osm_item':
src/osm_reader/osm_reader.c:367:1: warning: control reaches end of non-void function [-Wreturn-type]
  367 | }
      | ^
src/osm_fdw/osm_fdw.c:18:10: error: operator '==' has no left operand
   18 | # if PGV == 12 || PGV == 13 || PGV == 14
      |          ^~
/usr/lib64/ccache/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2  -Isrc/osm_reader -DPGV= -I. -I./ -I/usr/pgsql-15/include/server -I/usr/pgsql-15/include/internal  -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include -flto=thin -emit-llvm -c -o src/osm_reader/osmformat.pb-c.bc src/osm_reader/osmformat.pb-c.c
src/osm_fdw/osm_fdw.c:39:7: warning: no previous prototype for 'get_file_name' [-Wmissing-prototypes]
   39 | char* get_file_name(Oid foreigntableid) {
      |       ^~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c: In function 'get_file_name':
src/osm_fdw/osm_fdw.c:45:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   45 |     char *filename = NULL;
      |     ^~~~
src/osm_fdw/osm_fdw.c:53:22: error: operator '==' has no left operand
   53 |             # if PGV == 13 || PGV == 14
      |                      ^~
src/osm_fdw/osm_fdw.c:56:23: error: too many arguments to function 'list_delete_cell'
   56 |             options = list_delete_cell(options, lc, prev);
      |                       ^~~~~~~~~~~~~~~~
In file included from /usr/pgsql-15/include/server/nodes/primnodes.h:22,
                 from /usr/pgsql-15/include/server/nodes/parsenodes.h:27,
                 from /usr/pgsql-15/include/server/catalog/objectaddress.h:17,
                 from /usr/pgsql-15/include/server/catalog/pg_type.h:22,
                 from src/osm_fdw/osm_fdw.c:3:
/usr/pgsql-15/include/server/nodes/pg_list.h:569:27: note: declared here
  569 | extern pg_nodiscard List *list_delete_cell(List *list, ListCell *cell);
      |                           ^~~~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c: At top level:
src/osm_fdw/osm_fdw.c:73:1: warning: no previous prototype for 'GetForeignRelSize' [-Wmissing-prototypes]
   73 | GetForeignRelSize (PlannerInfo *root,
      | ^~~~~~~~~~~~~~~~~
In file included from src/osm_reader/osm_reader.h:14,
                 from src/osm_fdw/osm_fdw.c:26:
src/osm_fdw/osm_fdw.c: In function 'GetForeignRelSize':
src/osm_reader/type_defs.h:5:21: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    5 | #define file_size_t unsigned long
      |                     ^~~~~~~~
src/osm_fdw/osm_fdw.c:81:5: note: in expansion of macro 'file_size_t'
   81 |     file_size_t file_size = ftell(file);
      |     ^~~~~~~~~~~
src/osm_fdw/osm_fdw.c: At top level:
src/osm_fdw/osm_fdw.c:90:1: warning: no previous prototype for 'GetForeignPaths' [-Wmissing-prototypes]
   90 | GetForeignPaths (PlannerInfo *root,
      | ^~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c:39:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
};
^
src/osm_reader/osm_reader.c:302:12: warning: implicit declaration of function 'ntohl' is invalid in C99 [-Wimplicit-function-declaration]
    return ntohl(header_size);
           ^
src/osm_reader/osm_reader.c:367:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
}
^
3 warnings generated.
src/osm_fdw/osm_fdw.c: In function 'GetForeignPaths':
src/osm_fdw/osm_fdw.c:96:26: error: 'cpu_tuple_cost' undeclared (first use in this function)
   96 |     Cost cpu_per_tuple = cpu_tuple_cost * 10 + baserel->baserestrictcost.per_tuple;
      |                          ^~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c:96:26: note: each undeclared identifier is reported only once for each function it appears in
src/osm_fdw/osm_fdw.c:101:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  101 |     Cost total_cost = startup_cost + run_cost;
      |     ^~~~
src/osm_fdw/osm_fdw.c: At top level:
src/osm_fdw/osm_fdw.c:121:1: warning: no previous prototype for 'GetForeignPlan' [-Wmissing-prototypes]
  121 | GetForeignPlan (PlannerInfo *root,
      | ^~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c:143:1: warning: no previous prototype for 'BeginForeignScan' [-Wmissing-prototypes]
  143 | BeginForeignScan (ForeignScanState *node, int eflags) {
      | ^~~~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c: In function 'BeginForeignScan':
src/osm_fdw/osm_fdw.c:144:11: warning: unused variable 'version' [-Wunused-variable]
  144 |     char* version = PG_VERSION;
      |           ^~~~~~~
src/osm_fdw/osm_fdw.c: At top level:
src/osm_fdw/osm_fdw.c:164:1: warning: no previous prototype for 'IterateForeignScan' [-Wmissing-prototypes]
  164 | IterateForeignScan (ForeignScanState *node){
      | ^~~~~~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c: In function 'IterateForeignScan':
src/osm_fdw/osm_fdw.c:173:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  173 |     TupleTableSlot *slot = node->ss.ss_ScanTupleSlot;
      |     ^~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c:178:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  178 |     int64 p_id = (int64)item->id;
      |     ^~~~~
src/osm_fdw/osm_fdw.c:182:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  182 |     text *type_name;
      |     ^~~~
src/osm_fdw/osm_fdw.c:189:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  189 |     float8 p_lat = (float8)item->lat;
      |     ^~~~~~
src/osm_fdw/osm_fdw.c:198:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  198 |     float8 p_lon = (float8)item->lon;
      |     ^~~~~~
src/osm_fdw/osm_fdw.c:222:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  222 |         ArrayType *node_refs_array_values = construct_array(node_refs_array, item->node_refs_count, INT8OID, sizeof(int64), true, 'i');
      |         ^~~~~~~~~
src/osm_fdw/osm_fdw.c:240:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  240 |     int32 version = (int32)item->version;
      |     ^~~~~
src/osm_fdw/osm_fdw.c:244:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  244 |     pg_time_t changed_time = (pg_time_t)item->timestamp;
      |     ^~~~~~~~~
src/osm_fdw/osm_fdw.c:249:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  249 |     int64 changeset = (int64)item->changeset;
      |     ^~~~~
src/osm_fdw/osm_fdw.c:253:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  253 |     int32 uid = (int32)item->uid;
      |     ^~~~~
src/osm_fdw/osm_fdw.c:257:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  257 |     text *username = cstring_to_text(item->user);
      |     ^~~~
src/osm_fdw/osm_fdw.c: At top level:
src/osm_fdw/osm_fdw.c:268:1: warning: no previous prototype for 'ReScanForeignScan' [-Wmissing-prototypes]
  268 | ReScanForeignScan (ForeignScanState *node) {
      | ^~~~~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c:277:1: warning: no previous prototype for 'EndForeignScan' [-Wmissing-prototypes]
  277 | EndForeignScan (ForeignScanState *node) {
      | ^~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c: In function 'osm_fdw_validator':
src/osm_fdw/osm_fdw.c:321:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  321 |     List *options_list = untransformRelOptions(PG_GETARG_DATUM(0));
      |     ^~~~
make[1]: *** [<builtin>: src/osm_fdw/osm_fdw.o] Error 1
make[1]: *** Waiting for unfinished jobs....
src/osm_fdw/osm_fdw.c:18:10: error: invalid token at start of a preprocessor expression
# if PGV == 12 || PGV == 13 || PGV == 14
         ^
src/osm_fdw/osm_fdw.c:53:22: error: invalid token at start of a preprocessor expression
            # if PGV == 13 || PGV == 14
                     ^
src/osm_fdw/osm_fdw.c:56:53: error: too many arguments to function call, expected 2, have 3
            options = list_delete_cell(options, lc, prev);
                      ~~~~~~~~~~~~~~~~              ^~~~
/usr/pgsql-15/include/server/nodes/pg_list.h:569:27: note: 'list_delete_cell' declared here
extern pg_nodiscard List *list_delete_cell(List *list, ListCell *cell);
                          ^
src/osm_fdw/osm_fdw.c:96:26: error: use of undeclared identifier 'cpu_tuple_cost'
    Cost cpu_per_tuple = cpu_tuple_cost * 10 + baserel->baserestrictcost.per_tuple;
                         ^
4 errors generated.

PostgreSQL 12 support

Hi,

PostgreSQL 12 is due next week. Latest version in pgxn (3.1.0) fails to build against v12. Can you please push a new release with 12 support?

Thanks, Devrim

Build issues against GCC 10

Hi,

Build fails against GCC 10. Output is below. Can you please suggest a fix?

Thanks!

Regards, Devrim

[libprotobuf WARNING google/protobuf/compiler/parser.cc:646] No syntax specified for the proto file: fileformat.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.)
[libprotobuf WARNING google/protobuf/compiler/parser.cc:646] No syntax specified for the proto file: osmformat.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.)
src/osm_reader/type_defs.c:5:6: warning: no previous prototype for 'free_tag' [-Wmissing-prototypes]
    5 | void free_tag(OsmTag* tag) {
      |      ^~~~~~~~
src/osm_reader/type_defs.c:11:6: warning: no previous prototype for 'free_member' [-Wmissing-prototypes]
   11 | void free_member(OsmMember* member) {
      |      ^~~~~~~~~~~
src/osm_reader/type_defs.c:16:10: warning: no previous prototype for 'init_item' [-Wmissing-prototypes]
   16 | OsmItem* init_item() {
      |          ^~~~~~~~~
src/osm_reader/type_defs.c:92:9: warning: no previous prototype for 'alloc_cursor' [-Wmissing-prototypes]
   92 | Cursor* alloc_cursor() {
      |         ^~~~~~~~~~~~
src/osm_reader/zdecode.c: In function 'append_data':
src/osm_reader/zdecode.c:19:23: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
   19 |     memcpy(data->data + data->size, in, size);
      |                       ^
src/osm_reader/zdecode.c: At top level:
src/osm_reader/zdecode.c:23:16: warning: no previous prototype for 'init_resized_buffer' [-Wmissing-prototypes]
   23 | ResizedBuffer* init_resized_buffer() {
      |                ^~~~~~~~~~~~~~~~~~~
src/osm_reader/zdecode.c: In function 'zdecode':
src/osm_reader/zdecode.c:51:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   51 |     ResizedBuffer *result = init_resized_buffer();
      |     ^~~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_blob_header':
src/osm_reader/osm_reader.c:8:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    8 |     OSMPBF__BlobHeader *header;
      |     ^~~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_blob':
src/osm_reader/osm_reader.c:18:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   18 |     OSMPBF__Blob* blob = osmpbf__blob__unpack(NULL, header->datasize, buf);
      |     ^~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_osm_string_table':
src/osm_reader/osm_reader.c:44:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   44 |     char** strings = malloc(sizeof(char*) * stringtable->n_s);
      |     ^~~~
src/osm_reader/osm_reader.c: At top level:
src/osm_reader/osm_reader.c:65:8: warning: no previous prototype for 'get_lat' [-Wmissing-prototypes]
   65 | double get_lat(int64_t lat, OSMPBF__PrimitiveBlock* primitive_block){
      |        ^~~~~~~
src/osm_reader/osm_reader.c:82:8: warning: no previous prototype for 'get_lon' [-Wmissing-prototypes]
   82 | double get_lon(int64_t lon, OSMPBF__PrimitiveBlock* primitive_block){
      |        ^~~~~~~
src/osm_reader/osm_reader.c:99:8: warning: no previous prototype for 'get_timestamp' [-Wmissing-prototypes]
   99 | double get_timestamp(int64_t timestamp, OSMPBF__PrimitiveBlock* primitive_block) {
      |        ^~~~~~~~~~~~~
src/osm_reader/osm_reader.c:110:6: warning: no previous prototype for 'read_osm_dense_info' [-Wmissing-prototypes]
  110 | void read_osm_dense_info(OsmItem **items, OSMPBF__DenseInfo *info, char** strings, OSMPBF__PrimitiveBlock *primitive_block) {
      |      ^~~~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_osm_dense_nodes':
src/osm_reader/osm_reader.c:142:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  142 |     OsmItem **items = malloc(sizeof(OsmItem*) * dense->n_id);
      |     ^~~~~~~
src/osm_reader/osm_reader.c:152:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  152 |         OsmItem *item = init_item();
      |         ^~~~~~~
src/osm_reader/osm_reader.c:162:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  162 |     int item_index = 0;
      |     ^~~
src/osm_reader/osm_reader.c:171:13: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  171 |             OsmTag* tag = (OsmTag*)malloc(sizeof(OsmTag));
      |             ^~~~~~
src/osm_reader/osm_reader.c: At top level:
src/osm_reader/osm_reader.c:184:6: warning: no previous prototype for 'read_osm_info' [-Wmissing-prototypes]
  184 | void read_osm_info(OSMPBF__Info *info, char** strings, OsmItem* item, OSMPBF__PrimitiveBlock* primitive_block) {
      |      ^~~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_osm_way':
src/osm_reader/osm_reader.c:214:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  214 |     int32_t key_index, val_index;
      |     ^~~~~~~
src/osm_reader/osm_reader.c:219:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  219 |         OsmTag* tag = (OsmTag*)malloc(sizeof(OsmTag));
      |         ^~~~~~
src/osm_reader/osm_reader.c: In function 'read_osm_relation':
src/osm_reader/osm_reader.c:238:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  238 |     int32_t key_index, val_index;
      |     ^~~~~~~
src/osm_reader/osm_reader.c:243:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  243 |         OsmTag* tag = (OsmTag*)malloc(sizeof(OsmTag));
      |         ^~~~~~
src/osm_reader/osm_reader.c:249:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  249 |     int64_t member_id = 0;
      |     ^~~~~~~
src/osm_reader/osm_reader.c:252:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  252 |         OsmMember *member = (OsmMember*)malloc(sizeof(OsmMember));
      |         ^~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_osm_primitive_block':
src/osm_reader/osm_reader.c:291:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  291 |     int i;
      |     ^~~
src/osm_reader/osm_reader.c: At top level:
src/osm_reader/osm_reader.c:299:8: warning: no previous prototype for '_read_header_size' [-Wmissing-prototypes]
  299 | size_t _read_header_size(FILE* file) {
      |        ^~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function '_read_header_size':
src/osm_reader/osm_reader.c:302:12: warning: implicit declaration of function 'ntohl' [-Wimplicit-function-declaration]
  302 |     return ntohl(header_size);
      |            ^~~~~
src/osm_reader/osm_reader.c: At top level:
src/osm_reader/osm_reader.c:306:6: warning: no previous prototype for '_load_data_from_file' [-Wmissing-prototypes]
  306 | void _load_data_from_file(Cursor* cursor, FILE* file, short read_header) {
      |      ^~~~~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c:333:11: warning: no previous prototype for 'check_eof' [-Wmissing-prototypes]
  333 | short int check_eof(FILE* file, file_size_t file_size) {
      |           ^~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_blob_header':
src/osm_reader/osm_reader.c:7:5: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     fread(buf, header_size, 1, file);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_blob':
src/osm_reader/osm_reader.c:17:5: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     fread(buf, header->datasize, 1, file);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | };
      | ^
src/osm_reader/osm_reader.c: In function '_read_header_size':
src/osm_reader/osm_reader.c:301:5: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result]
  301 |     fread(&header_size, 4, 1, file);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_osm_item':
src/osm_reader/osm_reader.c:367:1: warning: control reaches end of non-void function [-Wreturn-type]
  367 | }
      | ^
src/osm_fdw/jsonb_encode.c:5:13: warning: no previous prototype for 'make_jsonb_string_value' [-Wmissing-prototypes]
    5 | JsonbValue* make_jsonb_string_value(char* string) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~
src/osm_fdw/jsonb_encode.c:15:13: warning: no previous prototype for 'make_jsonb_numeric_value' [-Wmissing-prototypes]
   15 | JsonbValue* make_jsonb_numeric_value(double value) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~~
src/osm_fdw/jsonb_encode.c: In function 'make_jsonb_numeric_value':
src/osm_fdw/jsonb_encode.c:18:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   18 |     Datum d_num_value = Float8GetDatum(value);
      |     ^~~~~
src/osm_fdw/jsonb_encode.c: At top level:
src/osm_fdw/jsonb_encode.c:26:13: warning: no previous prototype for 'make_jsonb_array' [-Wmissing-prototypes]
   26 | JsonbValue* make_jsonb_array(int elems_count, JsonbValue **elems) {
      |             ^~~~~~~~~~~~~~~~
src/osm_fdw/jsonb_encode.c: In function 'make_jsonb_array':
src/osm_fdw/jsonb_encode.c:30:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   30 |     int i;
      |     ^~~
src/osm_fdw/jsonb_encode.c: At top level:
src/osm_fdw/jsonb_encode.c:40:13: warning: no previous prototype for 'make_jsonb_object' [-Wmissing-prototypes]
   40 | JsonbValue* make_jsonb_object(int elems_count, JsonbValue **keys, JsonbValue **values) {
      |             ^~~~~~~~~~~~~~~~~
src/osm_fdw/jsonb_encode.c: In function 'make_jsonb_object':
src/osm_fdw/jsonb_encode.c:44:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   44 |     int i;
      |     ^~~
src/osm_fdw/jsonb_encode.c: In function 'jsonb_encode_tags':
src/osm_fdw/jsonb_encode.c:67:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   67 |     JsonbValue *jtags = make_jsonb_object(item->tags_count, jkeys, jvalues);
      |     ^~~~~~~~~~
src/osm_fdw/jsonb_encode.c: In function 'jsonb_encode_member':
src/osm_fdw/jsonb_encode.c:90:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   90 |     JsonbValue *jmember = make_jsonb_object(3, jkeys, jvalues);
      |     ^~~~~~~~~~
src/osm_fdw/jsonb_encode.c: In function 'jsonb_encode_members':
src/osm_fdw/jsonb_encode.c:104:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  104 |     JsonbValue *jmembers = make_jsonb_array(item->members_count, jvalues);
      |     ^~~~~~~~~~
src/osm_fdw/jsonb_encode.c:86:18: warning: 'member_type_name' may be used uninitialized in this function [-Wmaybe-uninitialized]
   86 |     jvalues[1] = make_jsonb_string_value(member_type_name);
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/osm_fdw/jsonb_encode.c:78:11: note: 'member_type_name' was declared here
   78 |     char* member_type_name;
      |           ^~~~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c:18:10: error: operator '==' has no left operand
   18 | # if PGV == 12
      |          ^~
src/osm_fdw/osm_fdw.c:39:7: warning: no previous prototype for 'get_file_name' [-Wmissing-prototypes]
   39 | char* get_file_name(Oid foreigntableid) {
      |       ^~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c: In function 'get_file_name':
src/osm_fdw/osm_fdw.c:45:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   45 |     char *filename = NULL;
      |     ^~~~
src/osm_fdw/osm_fdw.c: At top level:
src/osm_fdw/osm_fdw.c:69:1: warning: no previous prototype for 'GetForeignRelSize' [-Wmissing-prototypes]
   69 | GetForeignRelSize (PlannerInfo *root,
      | ^~~~~~~~~~~~~~~~~
In file included from src/osm_reader/osm_reader.h:14,
                 from src/osm_fdw/osm_fdw.c:26:
src/osm_fdw/osm_fdw.c: In function 'GetForeignRelSize':
src/osm_reader/type_defs.h:5:21: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    5 | #define file_size_t unsigned long
      |                     ^~~~~~~~
src/osm_fdw/osm_fdw.c:77:5: note: in expansion of macro 'file_size_t'
   77 |     file_size_t file_size = ftell(file);
      |     ^~~~~~~~~~~
src/osm_fdw/osm_fdw.c: At top level:
src/osm_fdw/osm_fdw.c:86:1: warning: no previous prototype for 'GetForeignPaths' [-Wmissing-prototypes]
   86 | GetForeignPaths (PlannerInfo *root,
      | ^~~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c: In function 'GetForeignPaths':
src/osm_fdw/osm_fdw.c:97:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   97 |     Cost total_cost = startup_cost + run_cost;
      |     ^~~~
src/osm_fdw/osm_fdw.c: At top level:
src/osm_fdw/osm_fdw.c:117:1: warning: no previous prototype for 'GetForeignPlan' [-Wmissing-prototypes]
  117 | GetForeignPlan (PlannerInfo *root,
      | ^~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c:139:1: warning: no previous prototype for 'BeginForeignScan' [-Wmissing-prototypes]
  139 | BeginForeignScan (ForeignScanState *node, int eflags) {
      | ^~~~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c: In function 'BeginForeignScan':
src/osm_fdw/osm_fdw.c:140:11: warning: unused variable 'version' [-Wunused-variable]
  140 |     char* version = PG_VERSION;
      |           ^~~~~~~
src/osm_fdw/osm_fdw.c: At top level:
src/osm_fdw/osm_fdw.c:160:1: warning: no previous prototype for 'IterateForeignScan' [-Wmissing-prototypes]
  160 | IterateForeignScan (ForeignScanState *node){
      | ^~~~~~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c: In function 'IterateForeignScan':
src/osm_fdw/osm_fdw.c:169:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  169 |     TupleTableSlot *slot = node->ss.ss_ScanTupleSlot;
      |     ^~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c:174:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  174 |     int64 p_id = (int64)item->id;
      |     ^~~~~
src/osm_fdw/osm_fdw.c:178:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  178 |     text *type_name;
      |     ^~~~
src/osm_fdw/osm_fdw.c:185:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  185 |     float8 p_lat = (float8)item->lat;
      |     ^~~~~~
src/osm_fdw/osm_fdw.c:194:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  194 |     float8 p_lon = (float8)item->lon;
      |     ^~~~~~
src/osm_fdw/osm_fdw.c:218:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  218 |         ArrayType *node_refs_array_values = construct_array(node_refs_array, item->node_refs_count, INT8OID, sizeof(int64), true, 'i');
      |         ^~~~~~~~~
src/osm_fdw/osm_fdw.c:236:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  236 |     int32 version = (int32)item->version;
      |     ^~~~~
src/osm_fdw/osm_fdw.c:240:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  240 |     pg_time_t changed_time = (pg_time_t)item->timestamp;
      |     ^~~~~~~~~
src/osm_fdw/osm_fdw.c:245:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  245 |     int64 changeset = (int64)item->changeset;
      |     ^~~~~
src/osm_fdw/osm_fdw.c:249:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  249 |     int32 uid = (int32)item->uid;
      |     ^~~~~
src/osm_fdw/osm_fdw.c:253:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  253 |     text *username = cstring_to_text(item->user);
      |     ^~~~
src/osm_fdw/osm_fdw.c: At top level:
src/osm_fdw/osm_fdw.c:264:1: warning: no previous prototype for 'ReScanForeignScan' [-Wmissing-prototypes]
  264 | ReScanForeignScan (ForeignScanState *node) {
      | ^~~~~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c:273:1: warning: no previous prototype for 'EndForeignScan' [-Wmissing-prototypes]
  273 | EndForeignScan (ForeignScanState *node) {
      | ^~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c: In function 'osm_fdw_validator':
src/osm_fdw/osm_fdw.c:317:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  317 |     List *options_list = untransformRelOptions(PG_GETARG_DATUM(0));
      |     ^~~~
make[1]: *** [<builtin>: src/osm_fdw/osm_fdw.o] Error 1
make[1]: *** Waiting for unfinished jobs....
error: Bad exit status from /var/tmp/rpm-tmp.GGDvxy (%build)

Crash on PG 11

Foreign table gets created ok, but when trying to select from this table it crashes postgres server process.
Running in docker, building from official alpine postgresql image.

GCC 13 build failures

Hi,

osm_obf_fdw fails to build against GCC 13 (Fedora 38). Can you please take a look? Thanks!

`gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fPIC -Isrc/osm_reader -DPGV= -I. -I./ -I/usr/pgsql-15/include/server -I/usr/pgsql-15/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o src/osm_reader/fileformat.pb-c.o src/osm_reader/fileformat.pb-c.c
src/osm_reader/type_defs.c:5:6: warning: no previous prototype for 'free_tag' [-Wmissing-prototypes]
5 | void free_tag(OsmTag* tag) {
| ^~~~~~~~
src/osm_reader/type_defs.c:11:6: warning: no previous prototype for 'free_member' [-Wmissing-prototypes]
11 | void free_member(OsmMember* member) {
| ^~~~~~~~~~~
src/osm_reader/type_defs.c:16:10: warning: no previous prototype for 'init_item' [-Wmissing-prototypes]
16 | OsmItem* init_item() {
| ^~~~~~~~~
src/osm_reader/type_defs.c:92:9: warning: no previous prototype for 'alloc_cursor' [-Wmissing-prototypes]
92 | Cursor* alloc_cursor() {
| ^~~~~~~~~~~~
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fPIC -Isrc/osm_reader -DPGV= -I. -I./ -I/usr/pgsql-15/include/server -I/usr/pgsql-15/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o src/osm_reader/osmformat.pb-c.o src/osm_reader/osmformat.pb-c.c
src/osm_reader/osm_reader.c: In function 'read_blob_header':
src/osm_reader/osm_reader.c:8:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
8 | OSMPBF__BlobHeader header;
| ^~~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_blob':
src/osm_reader/osm_reader.c:18:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
18 | OSMPBF__Blob
blob = osmpbf__blob__unpack(NULL, header->datasize, buf);
| ^~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_osm_string_table':
src/osm_reader/osm_reader.c:44:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
44 | char** strings = malloc(sizeof(char*) * stringtable->n_s);
| ^~~~
src/osm_reader/osm_reader.c: At top level:
src/osm_reader/osm_reader.c:65:8: warning: no previous prototype for 'get_lat' [-Wmissing-prototypes]
65 | double get_lat(int64_t lat, OSMPBF__PrimitiveBlock* primitive_block){
| ^~~~~~~
src/osm_reader/osm_reader.c:82:8: warning: no previous prototype for 'get_lon' [-Wmissing-prototypes]
82 | double get_lon(int64_t lon, OSMPBF__PrimitiveBlock* primitive_block){
| ^~~~~~~
src/osm_reader/osm_reader.c:99:8: warning: no previous prototype for 'get_timestamp' [-Wmissing-prototypes]
99 | double get_timestamp(int64_t timestamp, OSMPBF__PrimitiveBlock* primitive_block) {
| ^~~~~~~~~~~~~
src/osm_reader/osm_reader.c:110:6: warning: no previous prototype for 'read_osm_dense_info' [-Wmissing-prototypes]
110 | void read_osm_dense_info(OsmItem items, OSMPBF__DenseInfo info, char strings, OSMPBF__PrimitiveBlock primitive_block) {
| ^~~~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_osm_dense_nodes':
src/osm_reader/osm_reader.c:142:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
142 | OsmItem items = malloc(sizeof(OsmItem) * dense->n_id);
| ^~~~~~~
src/osm_reader/osm_reader.c:152:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
152 | OsmItem item = init_item();
| ^~~~~~~
src/osm_reader/osm_reader.c:162:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
162 | int item_index = 0;
| ^~~
src/osm_reader/osm_reader.c:171:13: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
171 | OsmTag
tag = (OsmTag
)malloc(sizeof(OsmTag));
| ^~~~~~
src/osm_reader/osm_reader.c: At top level:
src/osm_reader/osm_reader.c:184:6: warning: no previous prototype for 'read_osm_info' [-Wmissing-prototypes]
184 | void read_osm_info(OSMPBF__Info info, char
strings, OsmItem
item, OSMPBF__PrimitiveBlock* primitive_block) {
| ^~~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_osm_way':
src/osm_reader/osm_reader.c:214:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
214 | int32_t key_index, val_index;
| ^~~~~~~
src/osm_reader/osm_reader.c:219:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
219 | OsmTag* tag = (OsmTag*)malloc(sizeof(OsmTag));
| ^~~~~~
src/osm_reader/osm_reader.c: In function 'read_osm_relation':
src/osm_reader/osm_reader.c:238:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
238 | int32_t key_index, val_index;
| ^~~~~~~
src/osm_reader/osm_reader.c:243:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
243 | OsmTag* tag = (OsmTag*)malloc(sizeof(OsmTag));
| ^~~~~~
src/osm_reader/osm_reader.c:249:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
249 | int64_t member_id = 0;
| ^~~~~~~
src/osm_reader/osm_reader.c:252:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
252 | OsmMember member = (OsmMember)malloc(sizeof(OsmMember));
| ^~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_osm_primitive_block':
src/osm_reader/osm_reader.c:291:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
291 | int i;
| ^~~
src/osm_reader/osm_reader.c: At top level:
src/osm_reader/osm_reader.c:299:8: warning: no previous prototype for '_read_header_size' [-Wmissing-prototypes]
299 | size_t _read_header_size(FILE* file) {
| ^~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function '_read_header_size':
src/osm_reader/osm_reader.c:302:12: warning: implicit declaration of function 'ntohl' [-Wimplicit-function-declaration]
302 | return ntohl(header_size);
| ^~~~~
src/osm_reader/osm_reader.c: At top level:
src/osm_reader/osm_reader.c:306:6: warning: no previous prototype for '_load_data_from_file' [-Wmissing-prototypes]
306 | void _load_data_from_file(Cursor* cursor, FILE* file, short read_header) {
| ^~~~~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c:333:11: warning: no previous prototype for 'check_eof' [-Wmissing-prototypes]
333 | short int check_eof(FILE* file, file_size_t file_size) {
| ^~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_blob_header':
src/osm_reader/osm_reader.c:7:5: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result]
7 | fread(buf, header_size, 1, file);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_blob':
src/osm_reader/osm_reader.c:17:5: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result]
17 | fread(buf, header->datasize, 1, file);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c:39:1: warning: control reaches end of non-void function [-Wreturn-type]
39 | };
| ^
src/osm_reader/osm_reader.c: In function '_read_header_size':
src/osm_reader/osm_reader.c:301:5: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result]
301 | fread(&header_size, 4, 1, file);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c: In function 'read_osm_item':
src/osm_reader/osm_reader.c:367:1: warning: control reaches end of non-void function [-Wreturn-type]
367 | }
| ^
/usr/lib64/ccache/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Xclang -no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Wno-deprecated-non-prototype -O2 -Isrc/osm_reader -DPGV= -I. -I./ -I/usr/pgsql-15/include/server -I/usr/pgsql-15/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o src/osm_reader/fileformat.pb-c.bc src/osm_reader/fileformat.pb-c.c
src/osm_reader/zdecode.c: In function 'append_data':
src/osm_reader/zdecode.c:19:23: warning: pointer of type 'void ' used in arithmetic [-Wpointer-arith]
19 | memcpy(data->data + data->size, in, size);
| ^
src/osm_reader/zdecode.c: At top level:
src/osm_reader/zdecode.c:23:16: warning: no previous prototype for 'init_resized_buffer' [-Wmissing-prototypes]
23 | ResizedBuffer
init_resized_buffer() {
| ^~~~~~~~~~~~~~~~~~~
src/osm_reader/zdecode.c: In function 'zdecode':
src/osm_reader/zdecode.c:51:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
51 | ResizedBuffer result = init_resized_buffer();
| ^~~~~~~~~~~~~
/usr/lib64/ccache/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Xclang -no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Wno-deprecated-non-prototype -O2 -Isrc/osm_reader -DPGV= -I. -I./ -I/usr/pgsql-15/include/server -I/usr/pgsql-15/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o src/osm_reader/osmformat.pb-c.bc src/osm_reader/osmformat.pb-c.c
src/osm_fdw/jsonb_encode.c:5:13: warning: no previous prototype for 'make_jsonb_string_value' [-Wmissing-prototypes]
5 | JsonbValue
make_jsonb_string_value(char* string) {
| ^~~~~~~~~~~~~~~~~~~~~~~
src/osm_fdw/jsonb_encode.c:15:13: warning: no previous prototype for 'make_jsonb_numeric_value' [-Wmissing-prototypes]
15 | JsonbValue* make_jsonb_numeric_value(double value) {
| ^~~~~~~~~~~~~~~~~~~~~~~~
src/osm_fdw/jsonb_encode.c: In function 'make_jsonb_numeric_value':
src/osm_fdw/jsonb_encode.c:18:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
18 | Datum d_num_value = Float8GetDatum(value);
| ^~~~~
src/osm_fdw/jsonb_encode.c: At top level:
src/osm_fdw/jsonb_encode.c:26:13: warning: no previous prototype for 'make_jsonb_array' [-Wmissing-prototypes]
26 | JsonbValue* make_jsonb_array(int elems_count, JsonbValue *elems) {
| ^~~~~~~~~~~~~~~~
src/osm_fdw/jsonb_encode.c: In function 'make_jsonb_array':
src/osm_fdw/jsonb_encode.c:30:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
30 | int i;
| ^~~
src/osm_fdw/jsonb_encode.c: At top level:
src/osm_fdw/jsonb_encode.c:40:13: warning: no previous prototype for 'make_jsonb_object' [-Wmissing-prototypes]
40 | JsonbValue
make_jsonb_object(int elems_count, JsonbValue **keys, JsonbValue **values) {
| ^~~~~~~~~~~~~~~~~
src/osm_fdw/jsonb_encode.c: In function 'make_jsonb_object':
src/osm_fdw/jsonb_encode.c:44:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
44 | int i;
| ^~~
src/osm_fdw/jsonb_encode.c: In function 'jsonb_encode_tags':
src/osm_fdw/jsonb_encode.c:67:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | JsonbValue *jtags = make_jsonb_object(item->tags_count, jkeys, jvalues);
| ^~~~~~~~~~
src/osm_fdw/jsonb_encode.c: In function 'jsonb_encode_member':
src/osm_fdw/jsonb_encode.c:90:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
90 | JsonbValue jmember = make_jsonb_object(3, jkeys, jvalues);
| ^~~~~~~~~~
src/osm_fdw/jsonb_encode.c: In function 'jsonb_encode_members':
src/osm_fdw/jsonb_encode.c:104:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
104 | JsonbValue jmembers = make_jsonb_array(item->members_count, jvalues);
| ^~~~~~~~~~
In function 'jsonb_encode_member',
inlined from 'jsonb_encode_members' at src/osm_fdw/jsonb_encode.c:102:22:
src/osm_fdw/jsonb_encode.c:86:18: warning: 'member_type_name' may be used uninitialized [-Wmaybe-uninitialized]
86 | jvalues[1] = make_jsonb_string_value(member_type_name);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/osm_fdw/jsonb_encode.c: In function 'jsonb_encode_members':
src/osm_fdw/jsonb_encode.c:78:11: note: 'member_type_name' was declared here
78 | char
member_type_name;
| ^~~~~~~~~~~~~~~~
src/osm_reader/osm_reader.c:39:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
};
^
src/osm_reader/osm_reader.c:302:12: error: call to undeclared function 'ntohl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
return ntohl(header_size);
^
1 warning and 1 error generated.
make[1]: *** [/usr/pgsql-15/lib/pgxs/src/makefiles/../../src/Makefile.global:1081: src/osm_reader/osm_reader.bc] Error 1
make[1]: *** Waiting for unfinished jobs....
src/osm_fdw/osm_fdw.c:18:10: error: operator '==' has no left operand
18 | # if PGV == 12 || PGV == 13 || PGV == 14
| ^~
src/osm_fdw/osm_fdw.c:39:7: warning: no previous prototype for 'get_file_name' [-Wmissing-prototypes]
39 | char
get_file_name(Oid foreigntableid) {
| ^~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c: In function 'get_file_name':
src/osm_fdw/osm_fdw.c:45:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
45 | char *filename = NULL;
| ^~~~
src/osm_fdw/osm_fdw.c:53:22: error: operator '==' has no left operand
53 | # if PGV == 13 || PGV == 14
| ^~
src/osm_fdw/osm_fdw.c:56:23: error: too many arguments to function 'list_delete_cell'
56 | options = list_delete_cell(options, lc, prev);
| ^~~~~~~~~~~~~~~~
In file included from /usr/pgsql-15/include/server/nodes/primnodes.h:22,
from /usr/pgsql-15/include/server/nodes/parsenodes.h:27,
from /usr/pgsql-15/include/server/catalog/objectaddress.h:17,
from /usr/pgsql-15/include/server/catalog/pg_type.h:22,
from src/osm_fdw/osm_fdw.c:3:
/usr/pgsql-15/include/server/nodes/pg_list.h:569:27: note: declared here
569 | extern pg_nodiscard List *list_delete_cell(List *list, ListCell *cell);
| ^~~~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c: At top level:
src/osm_fdw/osm_fdw.c:73:1: warning: no previous prototype for 'GetForeignRelSize' [-Wmissing-prototypes]
73 | GetForeignRelSize (PlannerInfo *root,
| ^~~~~~~~~~~~~~~~~
In file included from src/osm_reader/osm_reader.h:14,
from src/osm_fdw/osm_fdw.c:26:
src/osm_fdw/osm_fdw.c: In function 'GetForeignRelSize':
src/osm_reader/type_defs.h:5:21: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
5 | #define file_size_t unsigned long
| ^~~~~~~~
src/osm_fdw/osm_fdw.c:81:5: note: in expansion of macro 'file_size_t'
81 | file_size_t file_size = ftell(file);
| ^~~~~~~~~~~
src/osm_fdw/osm_fdw.c: At top level:
src/osm_fdw/osm_fdw.c:90:1: warning: no previous prototype for 'GetForeignPaths' [-Wmissing-prototypes]
90 | GetForeignPaths (PlannerInfo *root,
| ^~~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c: In function 'GetForeignPaths':
src/osm_fdw/osm_fdw.c:96:26: error: 'cpu_tuple_cost' undeclared (first use in this function)
96 | Cost cpu_per_tuple = cpu_tuple_cost * 10 + baserel->baserestrictcost.per_tuple;
| ^~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c:96:26: note: each undeclared identifier is reported only once for each function it appears in
src/osm_fdw/osm_fdw.c:101:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
101 | Cost total_cost = startup_cost + run_cost;
| ^~~~
src/osm_fdw/osm_fdw.c: At top level:
src/osm_fdw/osm_fdw.c:121:1: warning: no previous prototype for 'GetForeignPlan' [-Wmissing-prototypes]
121 | GetForeignPlan (PlannerInfo *root,
| ^~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c:143:1: warning: no previous prototype for 'BeginForeignScan' [-Wmissing-prototypes]
143 | BeginForeignScan (ForeignScanState node, int eflags) {
| ^~~~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c: In function 'BeginForeignScan':
src/osm_fdw/osm_fdw.c:144:11: warning: unused variable 'version' [-Wunused-variable]
144 | char
version = PG_VERSION;
| ^~~~~~~
src/osm_fdw/osm_fdw.c: At top level:
src/osm_fdw/osm_fdw.c:164:1: warning: no previous prototype for 'IterateForeignScan' [-Wmissing-prototypes]
164 | IterateForeignScan (ForeignScanState *node){
| ^~~~~~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c: In function 'IterateForeignScan':
src/osm_fdw/osm_fdw.c:173:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
173 | TupleTableSlot *slot = node->ss.ss_ScanTupleSlot;
| ^~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c:178:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
178 | int64 p_id = (int64)item->id;
| ^~~~~
src/osm_fdw/osm_fdw.c:182:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
182 | text *type_name;
| ^~~~
src/osm_fdw/osm_fdw.c:189:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
189 | float8 p_lat = (float8)item->lat;
| ^~~~~~
src/osm_fdw/osm_fdw.c:198:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
198 | float8 p_lon = (float8)item->lon;
| ^~~~~~
src/osm_fdw/osm_fdw.c:222:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
222 | ArrayType *node_refs_array_values = construct_array(node_refs_array, item->node_refs_count, INT8OID, sizeof(int64), true, 'i');
| ^~~~~~~~~
src/osm_fdw/osm_fdw.c:240:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
240 | int32 version = (int32)item->version;
| ^~~~~
src/osm_fdw/osm_fdw.c:244:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
244 | pg_time_t changed_time = (pg_time_t)item->timestamp;
| ^~~~~~~~~
src/osm_fdw/osm_fdw.c:249:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
249 | int64 changeset = (int64)item->changeset;
| ^~~~~
src/osm_fdw/osm_fdw.c:253:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
253 | int32 uid = (int32)item->uid;
| ^~~~~
src/osm_fdw/osm_fdw.c:257:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
257 | text *username = cstring_to_text(item->user);
| ^~~~
src/osm_fdw/osm_fdw.c: At top level:
src/osm_fdw/osm_fdw.c:268:1: warning: no previous prototype for 'ReScanForeignScan' [-Wmissing-prototypes]
268 | ReScanForeignScan (ForeignScanState *node) {
| ^~~~~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c:277:1: warning: no previous prototype for 'EndForeignScan' [-Wmissing-prototypes]
277 | EndForeignScan (ForeignScanState *node) {
| ^~~~~~~~~~~~~~
src/osm_fdw/osm_fdw.c: In function 'osm_fdw_validator':
src/osm_fdw/osm_fdw.c:321:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
321 | List *options_list = untransformRelOptions(PG_GETARG_DATUM(0));
| ^~~~
make[1]: *** [: src/osm_fdw/osm_fdw.o] Error 1
src/osm_fdw/osm_fdw.c:18:10: error: invalid token at start of a preprocessor expression

if PGV == 12 || PGV == 13 || PGV == 14

     ^

src/osm_fdw/osm_fdw.c:53:22: error: invalid token at start of a preprocessor expression
# if PGV == 13 || PGV == 14
^
src/osm_fdw/osm_fdw.c:56:53: error: too many arguments to function call, expected 2, have 3
options = list_delete_cell(options, lc, prev);
~~~~~~~~~~~~~~~~ ^~~~
/usr/pgsql-15/include/server/nodes/pg_list.h:569:27: note: 'list_delete_cell' declared here
extern pg_nodiscard List *list_delete_cell(List *list, ListCell *cell);
^
src/osm_fdw/osm_fdw.c:96:26: error: use of undeclared identifier 'cpu_tuple_cost'
Cost cpu_per_tuple = cpu_tuple_cost * 10 + baserel->baserestrictcost.per_tuple;
^
4 errors generated.
make[1]: *** [/usr/pgsql-15/lib/pgxs/src/makefiles/../../src/Makefile.global:1081: src/osm_fdw/osm_fdw.bc] Error 1
`

Debian buster and PostgreSQL12 unable to install

I Installed the requirements (package names changed from deb 9)

apt install postgresql-server-dev-all libjson-c-dev libjson-c3 libprotobuf-dev protobuf-compiler libprotobuf-c1 zlib1g-dev zlib1g

and tried to install in debian buster (pg12) using pgnx tool and the got this error:

root@Database:/var/lib/postgresql# pgxn install osm_fdw
INFO: best version: osm_fdw 4.0.0
INFO: saving /tmp/tmpDU76MG/osm_fdw-4.0.0.zip
INFO: unpacking: /tmp/tmpDU76MG/osm_fdw-4.0.0.zip
INFO: building extension
make -C src/osm_reader fileformat.pb-c.c
make[1]: Entering directory '/tmp/tmpDU76MG/osm_fdw-4.0.0/src/osm_reader'
protoc-c --c_out=/tmp/tmpDU76MG/osm_fdw-4.0.0/src/osm_reader fileformat.proto
make[1]: protoc-c: Command not found
Makefile:5: recipe for target 'fileformat.pb-c.c' failed
make[1]: *** [fileformat.pb-c.c] Error 127
make[1]: Leaving directory '/tmp/tmpDU76MG/osm_fdw-4.0.0/src/osm_reader'
Makefile:50: recipe for target 'src/osm_reader/fileformat.pb-c.c' failed
make: *** [src/osm_reader/fileformat.pb-c.c] Error 2
ERROR: command returned 2: make PG_CONFIG=/usr/bin/pg_config all

It seems the tool named protoc-c, changed protoc , I create an alias (symlink) , but got this error:

root@Database:/var/lib/postgresql# pgxn install osm_fdw                                                                                                                    
INFO: best version: osm_fdw 4.0.0                      
INFO: saving /tmp/tmpwVSNfz/osm_fdw-4.0.0.zip                            
INFO: unpacking: /tmp/tmpwVSNfz/osm_fdw-4.0.0.zip                                                                                                                        
INFO: building extension                                                                                                                                                   
make -C src/osm_reader fileformat.pb-c.c                                                                                                                                   
make[1]: Entering directory '/tmp/tmpwVSNfz/osm_fdw-4.0.0/src/osm_reader'                                                                                                  
protoc-c --c_out=/tmp/tmpwVSNfz/osm_fdw-4.0.0/src/osm_reader fileformat.proto
[libprotobuf WARNING google/protobuf/compiler/parser.cc:547] No syntax specified for the proto file: fileformat.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' t
o specify a syntax version. (Defaulted to proto2 syntax.)                                                                                                                
protoc-gen-c: program not found or is not executable                                                                                                                       
--c_out: protoc-gen-c: Plugin failed with status code 1.                                                                                                                 
Makefile:5: recipe for target 'fileformat.pb-c.c' failed                                                                                                                 
make[1]: *** [fileformat.pb-c.c] Error 1                                              
make[1]: Leaving directory '/tmp/tmpwVSNfz/osm_fdw-4.0.0/src/osm_reader'                     
Makefile:50: recipe for target 'src/osm_reader/fileformat.pb-c.c' failed                                                                                                 
make: *** [src/osm_reader/fileformat.pb-c.c] Error 2

I guess it is not yet compatible to pg12, but I would like to help in port if you plan to do it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.