Code Monkey home page Code Monkey logo

jsquery's Introduction

Build Status codecov GitHub license

JsQuery – json query language with GIN indexing support

Introduction

JsQuery – is a language to query jsonb data type, introduced in PostgreSQL release 9.4.

It's primary goal is to provide an additional functionality to jsonb (currently missing in PostgreSQL), such as a simple and effective way to search in nested objects and arrays, more comparison operators with indexes support. We hope, that jsquery will be eventually a part of PostgreSQL.

Jsquery is released as jsquery data type (similar to tsquery) and @@ match operator for jsonb.

Authors

Availability

JsQuery is realized as an extension and not available in default PostgreSQL installation. It is available from github under the same license as PostgreSQL and supports PostgreSQL 9.4+.

Regards

Development was sponsored by Wargaming.net.

Installation

JsQuery is PostgreSQL extension which requires PostgreSQL 9.4 or higher. Before build and install you should ensure following:

  • PostgreSQL version is 9.4 or higher.
  • You have development package of PostgreSQL installed or you built PostgreSQL from source.
  • You have flex and bison installed on your system. JsQuery was tested on flex 2.5.37-2.5.39, bison 2.7.12.
  • Your PATH variable is configured so that pg_config command available, or set PG_CONFIG variable.

Typical installation procedure may look like this:

$ git clone https://github.com/postgrespro/jsquery.git
$ cd jsquery
$ make USE_PGXS=1
$ sudo make USE_PGXS=1 install
$ make USE_PGXS=1 installcheck
$ psql DB -c "CREATE EXTENSION jsquery;"

JSON query language

JsQuery extension contains jsquery datatype which represents whole JSON query as a single value (like tsquery does for fulltext search). The query is an expression on JSON-document values.

Simple expression is specified as path binary_operator value or path unary_operator. See following examples.

  • x = "abc" – value of key "x" is equal to "abc";
  • $ @> [4, 5, "zzz"] – the JSON document is an array containing values 4, 5 and "zzz";
  • "abc xyz" >= 10 – value of key "abc xyz" is greater than or equal to 10;
  • volume IS NUMERIC – type of key "volume" is numeric.
  • $ = true – the whole JSON document is just a true.
  • similar_ids.@# > 5 – similar_ids is an array or object of length greater than 5;
  • similar_product_ids.# = "0684824396" – array "similar_product_ids" contains string "0684824396".
  • *.color = "red" – there is object somewhere which key "color" has value "red".
  • foo = * – key "foo" exists in object.

Path selects a set of JSON values to be checked using given operators. In the simplest case path is just a key name. In general path is key names and placeholders combined by dot signs. Path can use the following placeholders:

  • # – any index of an array;
  • #N – N-th index of an array;
  • % – any key of an object;
  • * – any sequence of array indexes and object keys;
  • @# – length of array or object, may only be used as the last component of a path;
  • $ – the whole JSON document as single value, may only be the whole path.

Expression is true when operator is true against at least one value selected by path.

Key names could be given either with or without double quotes. Key names without double quotes may not contain spaces, start with a number or match a jsquery keyword.

The supported binary operators are:

  • Equality operator: =;
  • Numeric comparison operators: >, >=, <, <=;
  • Search in the list of scalar values using IN operator;
  • Array comparison operators: && (overlap), @> (contains), <@ (contained in).

The supported unary operators are:

  • Check for existence operator: = *;
  • Check for type operators: IS ARRAY, IS NUMERIC, IS OBJECT, IS STRING and IS BOOLEAN.

Expressions can be complex. Complex expression is a set of expressions combined by logical operators (AND, OR, NOT) and grouped using braces.

Examples of complex expressions:

  • a = 1 AND (b = 2 OR c = 3) AND NOT d = 1
  • x.% = true OR x.# = true

Prefix expressions are expressions given in the form path (subexpression). In this case path selects JSON values to be checked using the given subexpression. Check results are aggregated in the same way as in simple expressions.

  • #(a = 1 AND b = 2) – exists element of array which a key is 1 and b key is 2
  • %($ >= 10 AND $ <= 20) – exists object key which values is between 10 and 20

Path can also contain the following special placeholders with "every" semantics:

  • #: – every index of an array;
  • %: – every key of an object;
  • *: – every sequence of array indexes and object keys.

Consider following example.

%.#:($ >= 0 AND $ <= 1)

This example could be read as following: there is at least one key whose value is an array of numerics between 0 and 1.

We can rewrite this example in the following form with extra braces:

%(#:($ >= 0 AND $ <= 1))

The first placeholder % checks that the expression in braces is true for at least one value in the object. The second placeholder #: checks if the value is an array and that all its elements satisfy the expressions in braces.

We can rewrite this example without the #: placeholder as follows:

%(NOT #(NOT ($ >= 0 AND $ <= 1)) AND $ IS ARRAY)

In this example we transform the assertion that every element of array satisfy some condition to an assertion that there are no elements which don't satisfy the same condition.

Some examples of using paths:

  • numbers.#: IS NUMERIC – every element of "numbers" array is numeric.
  • *:($ IS OBJECT OR $ IS BOOLEAN) – JSON is a structure of nested objects with booleans as leaf values.
  • #:.%:($ >= 0 AND $ <= 1) – each element of array is an object containing only numeric values between 0 and 1.
  • documents.#:.% = * – "documents" is an array of objects containing at least one key.
  • %.#: ($ IS STRING) – JSON object contains at least one array of strings.
  • #.% = true – at least one array element is an object which contains at least one "true" value.

The use of path operators and braces need some further explanation. When the same path operators are used multiple times, they may refer to different values. If you want them to always refer to the same value, you must use braces and the $ operator. For example:

  • # < 10 AND # > 20 – an element less than 10 exists, and another element greater than 20 exists.
  • #($ < 10 AND $ > 20) – an element which is both less than 10 and greater than 20 exists (impossible).
  • #($ >= 10 AND $ <= 20) – an element between 10 and 20 exists.
  • # >= 10 AND # <= 20 – an element greater or equal to 10 exists, and another element less or equal to 20 exists. Please note that this query also can be satisfied by an array with no elements between 10 and 20, for instance [0,30].

Same rules apply when searching inside objects and branch structures.

Type checking operators and "every" placeholders are useful for document schema validation. JsQuery matchig operator @@ is immutable and can be used in CHECK constraint. See following example.

CREATE TABLE js (
    id serial,
    data jsonb,
    CHECK (data @@ '
        name IS STRING AND
        similar_ids.#: IS NUMERIC AND
        points.#:(x IS NUMERIC AND y IS NUMERIC)'::jsquery));

In this example the check constraint validates that in the "data" jsonb column the value of the "name" key is a string, the value of the "similar_ids" key is an array of numerics, and the value of the "points" key is an array of objects which contain numeric values in "x" and "y" keys.

See our pgconf.eu presentation for more examples.

GIN indexes

JsQuery extension contains two operator classes (opclasses) for GIN which provide different kinds of query optimization.

  • jsonb_path_value_ops
  • jsonb_value_path_ops

In each of two GIN opclasses jsonb documents are decomposed into entries. Each entry is associated with a particular value and its path. The difference between opclasses is in the entry representation, comparison and usage for search optimization.

For example, the jsonb document {"a": [{"b": "xyz", "c": true}, 10], "d": {"e": [7, false]}} would be decomposed into following entries:

  • "a".#."b"."xyz"
  • "a".#."c".true
  • "a".#.10
  • "d"."e".#.7
  • "d"."e".#.false

Since JsQuery doesn't support searching in a particular array index, we consider all array elements to be equivalent. Thus, each array element is marked with the same # sign in its path.

Major problem in the entries representation is its size. In the given example the key "a" is presented three times. In large branchy documents with long keys sizes of naive entries, the representation becomes unreasonably large. Both opclasses address this issue, but in slightly different ways.

jsonb_path_value_ops

jsonb_path_value_ops represents entry as pair of path hash and value. Following pseudocode illustrates it:

(hash(path_item_1.path_item_2. ... .path_item_n); value)

When comparison entries, the path hash is the higher part of entry and the value is the lower part. This determines the features of this opclass. Since the path is hashed and it's the higher part of the entry, we need to know the full path to a value in order to use the it for searching. However, once the path is specified we can use both exact and range searches very efficiently.

jsonb_value_path_ops

jsonb_value_path_ops represents entry as pair of the value and a bloom filter of paths:

(value; bloom(path_item_1) | bloom(path_item_2) | ... | bloom(path_item_n))

In comparison of entries value is the higher part of entry and bloom filter of path is its lower part. This determines the features of this opclass. Since the value is the higher part of an entry, we can only perform exact value search effectively. A search over a range of values is possible as well, but we have to filter all the the different paths where matching values occur. The Bloom filter over path items allows the index to be used for conditions containing % and * in their paths.

Query optimization

JsQuery opclasses perform complex query optimization. It's valuable for a developer or administrator to see the result of such optimization. Unfortunately, opclasses aren't allowed to put any custom output in an EXPLAIN. That's why JsQuery provides these functions to let you see how particular opclass optimizes given query:

  • gin_debug_query_path_value(jsquery) – for jsonb_path_value_ops
  • gin_debug_query_value_path(jsquery) – for jsonb_value_path_ops

The result of these functions is a textual representation of the query tree where leaves are GIN search entries. Following examples show different results of query optimization by different opclasses:

# SELECT gin_debug_query_path_value('x = 1 AND (*.y = 1 OR y = 2)');
 gin_debug_query_path_value
----------------------------
 x = 1 , entry 0           +

# SELECT gin_debug_query_value_path('x = 1 AND (*.y = 1 OR y = 2)');
 gin_debug_query_value_path
----------------------------
 AND                       +
   x = 1 , entry 0         +
   OR                      +
     *.y = 1 , entry 1     +
     y = 2 , entry 2       +

Unfortunately, jsonb have no statistics yet. That's why JsQuery optimizer has to do imperative decision while selecting conditions to be evaluated using index. This decision is made by assuming that some condition types are less selective than others. The optimizer divides conditions into following selectivity classes (listed in descending order of selectivity):

  1. Equality (x = c)
  2. Range (c1 < x < c2)
  3. Inequality (x > c)
  4. Is (x is type)
  5. Any (x = *)

The optimizer avoids index evaluation of less selective conditions when possible. For example, in the x = 1 AND y > 0 query x = 1 is assumed to be more selective than y > 0. That's why the index isn't used for evaluation of y > 0.

# SELECT gin_debug_query_path_value('x = 1 AND y > 0');
 gin_debug_query_path_value
----------------------------
 x = 1 , entry 0           +

With the lack of statistics, decisions made by optimizer can be inaccurate. That's why JsQuery supports hints. The comments /*-- index */ or /*-- noindex */ placed in the conditions force the optimizer to use or not use an index correspondingly:

SELECT gin_debug_query_path_value('x = 1 AND y /*-- index */ > 0');
 gin_debug_query_path_value
----------------------------
 AND                       +
   x = 1 , entry 0         +
   y > 0 , entry 1         +

SELECT gin_debug_query_path_value('x /*-- noindex */ = 1 AND y > 0');
 gin_debug_query_path_value
 ----------------------------
  y > 0 , entry 0           +

Contribution

Please note that JsQuery is still under development. While it's stable and tested, it may contain some bugs. Don't hesitate to create issues at github with your bug reports.

If there's some functionality you'd like to see added to JsQuery and you feel like you can implement it, then you're welcome to make pull requests.

jsquery's People

Contributors

akorotkov avatar dlepikhova avatar ekho avatar feodor avatar ildus avatar jberkus avatar marinapolyakova avatar nikitos94 avatar readmecritic avatar sokolcati avatar vbwagner 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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  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  avatar  avatar  avatar

jsquery's Issues

Maximum number of elements "IN".

For the future system development, we are trying to use Postgres9.4.1 and jsquery,

JSONB and jsquery is indispensable for the general purpose of the data model.
We are grateful to your provision of function!

I have a question.
When using the "IN" as follows,
error occurs when the number of elements exceeds 16.

SELECT info FROM sampleTable WHERE info @@ 'orderDate IN ("2015/06/01", "2015/06/02", ... , "2015/06/17")';

Is it possible to increase the maximum number of elements?
For example 100.

Hideki Egami

Support for PostgreSQL 9.5+

Currently getting this error when building against 9.5devel as CRC has been changed:

jsquery_op.c:19:26: fatal error: utils/pg_crc.h: No such file or directory
 #include "utils/pg_crc.h"
                          ^

Could this be updated to support 9.5?

PG12+PG16 support

Hi,
could we have a new release with PG12 support so I can update the Debian packages?
Thanks!

Can not vacuum index which used jsquery in plpgsql

create database test;
\c test
create extension jsquery;
create table test(j jsonb);
insert into test values ('{"id":1,"test":"test"}');

CREATE OR REPLACE FUNCTION has_test(j jsonb) RETURNS boolean
LANGUAGE plpgsql IMMUTABLE
AS $$
DECLARE
ret boolean;
BEGIN
SELECT $1 @@ '$.test = test' into ret;
return ret;
END;
$
$;

CREATE INDEX test_index_plpgsql -- does't work in vacuum
ON test
USING btree
(has_test(j));

CREATE INDEX test_index_clear -- works fine
ON test
((j->>'id'))
WHERE j @@ '$.test = test';

vacuumdb -fzv --dbname=test
vacuumdb: vacuuming database "test"
INFO: vacuuming "public.test"
INFO: "test": found 0 removable, 1 nonremovable row versions in 1 pages
DETAIL: 0 dead row versions cannot be removed yet.
CPU: user: 0.01 s, system: 0.00 s, elapsed: 0.01 s.
vacuumdb: vacuuming of database "test" failed: ERROR: operator does not exist: jsonb @@ unknown
LINE 1: SELECT $1 @@ '$.test = test'
^
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
QUERY: SELECT $1 @@ '$.test = test'
CONTEXT: PL/pgSQL function public.has_test(jsonb) line 5 at SQL statement

ii postgresql-11 11.0-1.pgdg16.04+2 amd64
Package: postgresql-11
Status: install ok installed
Priority: optional
Section: database
Installed-Size: 43753
Maintainer: Debian PostgreSQL Maintainers [email protected]
Architecture: amd64
Version: 11.0-1.pgdg16.04+2
Provides: postgresql-contrib-11
Homepage: http://www.postgresql.org/
Postgresql-Catversion: 201809051

ii postgresql-11-jsquery 1.1.1-1.pgdg16.04+1 amd64
apt-cache show postgresql-11-jsquery
Package: postgresql-11-jsquery
Source: jsquery
Version: 1.1.1-1.pgdg16.04+1
Architecture: amd64
Maintainer: Debian PostgreSQL Maintainers [email protected]
Installed-Size: 290
Depends: postgresql-11, libc6 (>= 2.14)
Homepage: https://github.com/postgrespro/jsquery
Priority: optional
Section: database
Filename: pool/main/j/jsquery/postgresql-11-jsquery_1.1.1-1.pgdg16.04+1_amd64.deb
Size: 127560
SHA256: b6fdd08d91b83ca5ababe56af3c58dc2891a940102f838313d9f2bbcb8647974
SHA1: 88cab2e08e988ceb1811a82b3aec4c9f6838af44
MD5sum: 586f57fe09dd34c397ee17d2e17d2a95

ii postgresql-common 195.pgdg16.04+1 all

for pg9 - no problem

Question: jsquery in order by

I see how I can use the jsquery @@ operator in a WHERE clause or in a CHECK constraint. Is there an operator in either of the opclasses which would allow the use of the index in an ORDER BY clause? For example, suppose I have a table full of jsonb documents which look like:

{"time":1430432587, "place":"zoo", "animal_counts":{"monkeys":77, "tigers":3, "elephants":9.4}}

I would like to sort by animal_counts.tigers and I would like that sort to use the index.

Building on Windows

I need help in building JsQuery extension for Windows to use with PostgreSQL 9.4 for Windows.

jspath like simplified xpath

It would be cool to have jspath function (jsonb, text)->jsonb[],
which work like simplified xpath

jspath('{"a": {"b" :[{"c": any},{"c", any2}]}}', ' "a"."b".#."c" '))
=> {any, any2} 

error with postgresql 15

This happens when loading the extension (compiling it works without warning nor error):

tmp=# create extension jsquery;
ERROR: could not load library "/think/cs/re/2022-11-DB15_rh7/lib/postgresql/jsquery.so": /think/cs/re/2022-11-DB15_rh7/lib/postgresql/jsquery.so: undefined symbol: pg_atoi

Grepping for pg_atoi in pg 15's sources comes up empty, so it seems this symbol was removed.

Compiling jsquery did not raise any warnings, though.

Plans for support

Currently we are evaluating jsquery to be used in long-term project. So:

  1. I known about http://obartunov.livejournal.com/179422.html but do you have any plans for supporting it? Updating to next (9.5) releases?

  2. Could you advice any other solution which allows to store some kind of predicate for JSONB field as separated "object' (field, text, etc)

Installing extension in PostgreSQL 9.6

Hi, is it possible to install the extension to a system running PostgreSQL 9.6? I'm trying to do it on a system where I have 'bison' version 2.7 installed but it prints the following error after running the command $ make USE_PGXS=1:


ERROR: bison is missing on your system. It is needed to create the
file `jsquery_gram.c'. You can either get bison from a GNU mirror site
or download an official distribution of PostgreSQL, which contains
pre-packaged bison output.


Build Error: Missing jsquery_gram.h

Build on Ubuntu 14 and Postgres 9.5

~/jsquery$ make USE_PGXS=1
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -I/usr/include/mit-krb5 -fPIC -pie -fno-omit-frame-pointer -fpic -I. -I./ -I/usr/include/postgresql/9.5/server -I/usr/include/postgresql/internal -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/tcl8.6 -c -o jsquery_gram.o jsquery_gram.c
jsquery_gram.y:50:26: fatal error: jsquery_gram.h: No such file or directory
#include <jsquery_gram.h>

NOT operator lose index

Hi! Is it bug? Or what i do wrong?

=> explain analyze select * from mytable where ( data @@ 'NOT attr = *');
                                                      QUERY PLAN                                                      
----------------------------------------------------------------------------------------------------------------------
 Seq Scan on mytable  (cost=0.00..101937.27 rows=506315 width=254) (actual time=0.080..920.274 rows=483749 loops=1)
   Filter: (data @@ '(NOT "attr" = *)'::jsquery)
   Rows Removed by Filter: 23073
 Planning time: 2.892 ms
 Execution time: 966.762 ms

=> explain analyze select * from mytable where ( data @@ 'attr = *');
                                                                QUERY PLAN                                                              
----------------------------------------------------------------------------------------------------------------------------------------
 Bitmap Heap Scan on mytable  (cost=31.93..1951.83 rows=507 width=254) (actual time=41.431..135.250 rows=23073 loops=1)
   Recheck Cond: (data @@ '"attr" = *'::jsquery)
   Heap Blocks: exact=13967
   ->  Bitmap Index Scan on mytable_data_idx1  (cost=0.00..31.80 rows=507 width=0) (actual time=38.447..38.447 rows=23073 loops=
         Index Cond: (data @@ '"attr" = *'::jsquery)
 Planning time: 2.073 ms
 Execution time: 138.120 ms
(7 rows)

"make USE_PGXS=1 installcheck " Failed

Hi
I try to run the regression tests after installing jsquery and it fails with the error message
>>
+ERROR: operator is not unique: jsonb @@ unknown
+LINE 1: select '{"a": {"b": 1}}'::jsonb @@ 'a.* > 0';
+HINT: Could not choose a best candidate operator. You might need to add explicit type casts.
<<

Can you help me to solve this problem ?
Thanks in advance

Question about indexes

For example, jsonb document {"a": [{"b": "xyz", "c": true}, 10], "d": {"e": [7, false]}} would be decomposed into following entries:

"a".#."b"."xyz"
"a".#."c".true
"a".#.10
"d"."e".#.7
"d"."e".#.false

Since JsQuery doesn't support search in particular array index, we consider all array elements to be equivalent. Thus, each array element is marked with same # sign in the path.

If this is true then how do you make the distinction between two different arrays at the same level? Something like [[1,2,3][4,5,6]] would result in:
#.#.1
#.#.2
#.#.3
#.#.4
#.#.5
#.#.6
which makes the distinction impossible even though containment is respected by jsquery.

Can't install extension under macOS

I'm trying to test the extension under macOS but failing miserably.

Essentially, I can't even build the extension:

$ env USE_PGXS=1 make
make: Nothing to be done for `all'.
$

Was extension not meant to be installed under macOS?

I'm pretty sure versions of installed software have nothing to do the problem, but to give a little more insight into my env, here they are:

  • macOS 10.12.2,
  • postgresql 9.6.2 (installed via homebrew),
  • flex 2.6.3 (installed via homebrew),
  • bison 3.0.4 (installed via homebrew).

regression test failure with recent bison: syntax error, unexpected STRING_P, expecting end of file at or near """

With bison 3.7, some error message changed and makes the jsquery regression tests fail:

607--- /tmp/autopkgtest-lxc.qv5k86ce/downtmp/build.QH8/src/expected/jsquery.out	2020-07-27 04:40:49.000000000 +0000
608+++ /tmp/autopkgtest-lxc.qv5k86ce/downtmp/build.QH8/src/results/jsquery.out	2020-07-27 04:41:38.828913000 +0000
609@@ -67,7 +67,7 @@
610 ERROR:  bad jsquery representation
611 LINE 1: select '* < 13 AND #.zxc"x" = "true"'::jsquery;
612                ^
613-DETAIL:  syntax error, unexpected STRING_P, expecting $end at or near """
614+DETAIL:  syntax error, unexpected STRING_P, expecting end of file at or near """
615 select 'a < 1'::jsquery;
616  jsquery 
617 ---------
618@@ -1183,7 +1183,7 @@
619 ERROR:  bad jsquery representation
620 LINE 1: select 'a\r = x"\\abcd"'::jsquery AS err;
621                ^
622-DETAIL:  syntax error, unexpected STRING_P, expecting $end at or near """
623+DETAIL:  syntax error, unexpected STRING_P, expecting end of file at or near """
624 --IS
625 select  'as IS boolean OR as is ARRAY OR as is ObJect OR as is Numeric OR as is string'::jsquery;

Full test log: https://salsa.debian.org/postgresql/jsquery/-/jobs/891573

GCC 13 build failures

Hi,

jsqıery 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 -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 jsquery_support.o jsquery_support.c
/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  -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 jsonb_gin_ops.bc jsonb_gin_ops.c
/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  -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 jsquery_constr.bc jsquery_constr.c
In file included from /usr/pgsql-15/include/server/access/gin.h:14,
                 from jsquery.h:18,
                 from jsquery_support.c:17:
jsquery_support.c: In function 'alignStringInfoInt':
/usr/pgsql-15/include/server/lib/stringinfo.h:130:40: warning: this statement may fall through [-Wimplicit-fallthrough=]
  129 |         (((str)->len + 1 >= (str)->maxlen) ? \
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  130 |          appendStringInfoChar(str, ch) : \
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
  131 |          (void)((str)->data[(str)->len] = (ch), (str)->data[++(str)->len] = '\0'))
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jsquery_support.c:35:25: note: in expansion of macro 'appendStringInfoCharMacro'
   35 |                         appendStringInfoCharMacro(buf, 0);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
jsquery_support.c:36:17: note: here
   36 |                 case 2:
      |                 ^~~~
/usr/pgsql-15/include/server/lib/stringinfo.h:130:40: warning: this statement may fall through [-Wimplicit-fallthrough=]
  129 |         (((str)->len + 1 >= (str)->maxlen) ? \
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  130 |          appendStringInfoChar(str, ch) : \
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
  131 |          (void)((str)->data[(str)->len] = (ch), (str)->data[++(str)->len] = '\0'))
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jsquery_support.c:37:25: note: in expansion of macro 'appendStringInfoCharMacro'
   37 |                         appendStringInfoCharMacro(buf, 0);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
jsquery_support.c:38:17: note: here
   38 |                 case 1:
      |                 ^~~~
jsquery_support.c: In function 'jsqInitByBuffer':
jsquery_support.c:63:28: warning: this statement may fall through [-Wimplicit-fallthrough=]
   63 |                 case 3: pos++;
      |                         ~~~^~
jsquery_support.c:64:17: note: here
   64 |                 case 2: pos++;
      |                 ^~~~
jsquery_support.c:64:28: warning: this statement may fall through [-Wimplicit-fallthrough=]
   64 |                 case 2: pos++;
      |                         ~~~^~
jsquery_support.c:65:17: note: here
   65 |                 case 1: pos++;
      |                 ^~~~
jsquery_support.c:26:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
   26 |         (p) += sizeof(int32);                   \
      |         ~~~~^~~~~~~~~~~~~~~~
jsquery_support.c:88:25: note: in expansion of macro 'read_int32'
   88 |                         read_int32(v->value.datalen, base, pos);
      |                         ^~~~~~~~~~
jsquery_support.c:90:17: note: here
   90 |                 case jqiNumeric:
      |                 ^~~~
/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  -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 jsquery_extract.bc jsquery_extract.c
/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  -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 jsquery_gram.bc jsquery_gram.c
/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  -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 jsquery_io.bc jsquery_io.c
jsquery_io.c: In function 'flattenJsQueryParseItem':
jsquery_io.c:45:28: warning: this statement may fall through [-Wimplicit-fallthrough=]
   45 |                         if (onlyCurrentInPath)
      |                            ^
jsquery_io.c:47:17: note: here
   47 |                 case jqiString:
      |                 ^~~~
jsquery_io.c:118:25: warning: this statement may fall through [-Wimplicit-fallthrough=]
  118 |                         appendBinaryStringInfo(buf, (char*)&item->arrayIndex,
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  119 |                                                                    sizeof(item->arrayIndex));
      |                                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~
jsquery_io.c:120:17: note: here
  120 |                 case jqiAny:
      |                 ^~~~
jsquery_io.c: In function 'printJsQueryItem':
jsquery_io.c:239:28: warning: this statement may fall through [-Wimplicit-fallthrough=]
  239 |                         if (inKey)
      |                            ^
jsquery_io.c:242:17: note: here
  242 |                 case jqiString:
      |                 ^~~~
/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  -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 jsquery_op.bc jsquery_op.c
/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  -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 jsquery_support.bc jsquery_support.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 -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 -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 jsquery_gram.o jsquery_gram.c
jsquery_gram.y:73:18: error: call to undeclared function 'pg_atoi'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        v->arrayIndex = pg_atoi(s->val, 4, 0);
                        ^
1 error generated.
make[1]: *** [/usr/pgsql-15/lib/pgxs/src/makefiles/../../src/Makefile.global:1081: jsquery_gram.bc] Error 1
make[1]: *** Waiting for unfinished jobs....
jsquery_op.c: In function 'recursiveExecute':
jsquery_op.c:545:57: warning: variable 'r' set but not used [-Wunused-but-set-variable]
  545 |                                 int32                   r;
      |                                                         ^
jsquery_op.c:732:57: warning: variable 'r' set but not used [-Wunused-but-set-variable]
  732 |                                 int32                   r;
      |                                                         ^
jsquery_extract.c: In function 'recursiveExtract':
jsquery_extract.c:170:33: warning: this statement may fall through [-Wimplicit-fallthrough=]
  170 |                         else if (e.type != jqiArray)
      |                                 ^
jsquery_extract.c:182:17: note: here
  182 |                 case jqiIn:
      |                 ^~~~
jsquery_gram.y: In function 'makeIndexArray':
jsquery_gram.y:73:25: warning: implicit declaration of function 'pg_atoi'; did you mean 'pg_ltoa'? [-Wimplicit-function-declaration]
   73 |         v->arrayIndex = pg_atoi(s->val, 4, 0);
      |                         ^~~~~~~
      |                         pg_ltoa
make[1]: Leaving directory '/Projects/repo/pgrpms/rpm/redhat/main/non-common/jsquery/main/jsquery-ver_1.1.1'
error: Bad exit status from /var/tmp/rpm-tmp.ckoFhH (%build)


Doesn't build against 9.5

I'm getting an error building against 9.5devel:

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O2 -fpic -I. -I. -I../../src/include -D_GNU_SOURCE   -c -o jsquery_op.o jsquery_op.c -MMD -MP -MF .deps/jsquery_op.Po
jsquery_op.c:20:27: fatal error: common/pg_crc.h: No such file or directory
 #include "common/pg_crc.h"
                           ^
compilation terminated.
make: *** [jsquery_op.o] Error 1

pg_crc.h was initially moved to common, but is now back in utils (shown here), and this is now working for me with:

diff --git a/jsquery_op.c b/jsquery_op.c
index 1b3fd0d..e011c6a 100644
--- a/jsquery_op.c
+++ b/jsquery_op.c
@@ -17,14 +17,13 @@
 #include "miscadmin.h"
 #include "utils/builtins.h"
 #if PG_VERSION_NUM >= 90500
-#include "common/pg_crc.h"
 #define COMP_CRC32     COMP_CRC32C
 #define        INIT_CRC32      INIT_CRC32C
 #define        FIN_CRC32       FIN_CRC32C
 #define        INIT_CRC32      INIT_CRC32C
 #else
-#include "utils/pg_crc.h"
 #endif
+#include "utils/pg_crc.h"

 #include "jsquery.h"

Contained in operator (<@) does not work

create extension if not exists jsquery;
drop table if exists contained_test;
create table contained_test (data jsonb);
insert into contained_test values ('{"id": 1}'), ('{"id": 2}');
select * from contained_test where data @@ 'id IN (1, 2)'::jsquery; -- works, returning both records
select * from contained_test where data @@ 'id <@ [1, 2]'::jsquery; -- does not work, returning 0 rows

Using Jsquery 1.0 (compiled few days ago from master).

In readme it states that Jsquery supports "contained in" (<@) operator. Am I doing something wrong?

Building for Ubuntu 14.04

I had to install a couple other packages

sudo apt-get install postgresql-server-dev-all
sudo apt-get install flex
sudo apt-get install bison

jsquery_in/out compatibility issue

Hello,

While experimenting with jsquery, I encountered the following problem:

contrib_regression=# select 'NOT similar_product_ids.#: (NOT $ = "0440180295")'::jsquery::text::jsquery;
ERROR: bad jsquery representation
DETAIL: syntax error, unexpected NOT_P at or near " "

So, jsquery_in() fails to parse back the output generated by jsquery_out().

The problem seems to be with the jsquery_out(), which fails to add parenthesis around the expression:
contrib_regression=# select 'NOT similar_product_ids.#: (NOT $ = "0440180295")'::jsquery::text;

text

NOT ("similar_product_ids".#:NOT ($ = "0440180295"))
(1 row)

AFAICS jsquery_in() expects a parenthesis around the inner expression starting with 'NOT'. FWIW the attached patch fixes the problem for me, but I'm not sure if we should fix jsquery_out() or teach jsquery_in() to accept the above format.

Thanks,
Pavan
jsquery_in_out.txt

PostgreSQL 16 support

Hi,

jsquery latest release fails to build against v16. v16 is due next week. Will you release a new version?

...or a better question: Is this extension being maintained?

Regards, Devrim

/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 -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o jsonb_gin_ops.bc jsonb_gin_ops.c
In file included from /usr/pgsql-16/include/server/utils/elog.h:19,
from /usr/pgsql-16/include/server/postgres.h:46,
from jsquery_support.c:15:
jsquery_support.c: In function 'alignStringInfoInt':
/usr/pgsql-16/include/server/lib/stringinfo.h:130:40: warning: this statement may fall through [-Wimplicit-fallthrough=]
129 | (((str)->len + 1 >= (str)->maxlen) ?
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130 | appendStringInfoChar(str, ch) :
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
131 | (void)((str)->data[(str)->len] = (ch), (str)->data[++(str)->len] = '\0'))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jsquery_support.c:35:25: note: in expansion of macro 'appendStringInfoCharMacro'
35 | appendStringInfoCharMacro(buf, 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
jsquery_support.c:36:17: note: here
36 | case 2:
| ^~~~
/usr/pgsql-16/include/server/lib/stringinfo.h:130:40: warning: this statement may fall through [-Wimplicit-fallthrough=]
129 | (((str)->len + 1 >= (str)->maxlen) ?
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130 | appendStringInfoChar(str, ch) :
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
131 | (void)((str)->data[(str)->len] = (ch), (str)->data[++(str)->len] = '\0'))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jsquery_support.c:37:25: note: in expansion of macro 'appendStringInfoCharMacro'
37 | appendStringInfoCharMacro(buf, 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
jsquery_support.c:38:17: note: here
38 | case 1:
| ^~~~
jsquery_support.c: In function 'jsqInitByBuffer':
jsquery_support.c:63:28: warning: this statement may fall through [-Wimplicit-fallthrough=]
63 | case 3: pos++;
| ~~~^~
jsquery_support.c:64:17: note: here
64 | case 2: pos++;
| ^~~~
jsquery_support.c:64:28: warning: this statement may fall through [-Wimplicit-fallthrough=]
64 | case 2: pos++;
| ~~~^~
jsquery_support.c:65:17: note: here
65 | case 1: pos++;
| ^~~~
jsquery_support.c:26:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
26 | (p) += sizeof(int32);
| ~~~~^~~~~~~~~~~~~~~~
jsquery_support.c:88:25: note: in expansion of macro 'read_int32'
88 | read_int32(v->value.datalen, base, pos);
| ^~~~~~~~~~
jsquery_support.c:90:17: note: here
90 | case jqiNumeric:
| ^~~~
/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 -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o jsquery_constr.bc jsquery_constr.c
In file included from /usr/pgsql-16/include/server/utils/builtins.h:17,
from jsquery_io.c:18:
jsquery_io.c: In function 'jsquery_out':
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_io.c:400:39: note: in expansion of macro 'PG_GETARG_JSQUERY'
400 | JsQuery *in = PG_GETARG_JSQUERY(0);
| ^~~~~~~~~~~~~~~~~
In file included from jsquery_io.c:15:
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena '
312 | DatumGetPointer(Datum X)
| ~~~~~~^
jsquery_io.c: In function 'flattenJsQueryParseItem':
jsquery_io.c:45:28: warning: this statement may fall through [-Wimplicit-fallthrough=]
45 | if (onlyCurrentInPath)
| ^
jsquery_io.c:47:17: note: here
47 | case jqiString:
| ^~~~
jsquery_io.c:118:25: warning: this statement may fall through [-Wimplicit-fallthrough=]
118 | appendBinaryStringInfo(buf, (char
)&item->arrayIndex,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
119 | sizeof(item->arrayIndex));
| ~~~~~~~~~~~~~~~~~~~~~~~~~
jsquery_io.c:120:17: note: here
120 | case jqiAny:
| ^~~~
jsquery_io.c: In function 'printJsQueryItem':
jsquery_io.c:239:28: warning: this statement may fall through [-Wimplicit-fallthrough=]
239 | if (inKey)
| ^
jsquery_io.c:242:17: note: here
242 | case jqiString:
| ^~~~
In file included from /usr/pgsql-16/include/server/utils/builtins.h:17,
from jsquery_constr.c:18:
jsquery_constr.c: In function 'jsquery_join_and':
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_constr.c:196:32: note: in expansion of macro 'PG_GETARG_JSQUERY'
196 | JsQuery *jq1 = PG_GETARG_JSQUERY(0);
| ^~~~~~~~~~~~~~~~~
In file included from jsquery_constr.c:15:
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_constr.c:197:32: note: in expansion of macro 'PG_GETARG_JSQUERY'
197 | JsQuery *jq2 = PG_GETARG_JSQUERY(1);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
jsquery_constr.c: In function 'jsquery_join_or':
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_constr.c:212:32: note: in expansion of macro 'PG_GETARG_JSQUERY'
212 | JsQuery *jq1 = PG_GETARG_JSQUERY(0);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_constr.c:213:32: note: in expansion of macro 'PG_GETARG_JSQUERY'
213 | JsQuery *jq2 = PG_GETARG_JSQUERY(1);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
jsquery_constr.c: In function 'jsquery_not':
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_constr.c:228:39: note: in expansion of macro 'PG_GETARG_JSQUERY'
228 | JsQuery *jq = PG_GETARG_JSQUERY(0);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
jsquery_extract.c: In function 'recursiveExtract':
jsquery_extract.c:170:33: warning: this statement may fall through [-Wimplicit-fallthrough=]
170 | else if (e.type != jqiArray)
| ^
jsquery_extract.c:182:17: note: here
182 | case jqiIn:
| ^~~~
jsquery_op.c: In function 'recursiveExecute':
jsquery_op.c:545:57: warning: variable 'r' set but not used [-Wunused-but-set-variable]
545 | int32 r;
| ^
jsquery_op.c:732:57: warning: variable 'r' set but not used [-Wunused-but-set-variable]
732 | int32 r;
| ^
In file included from /usr/pgsql-16/include/server/utils/builtins.h:17,
from jsquery_op.c:18:
jsquery_op.c: In function 'jsquery_json_exec':
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_op.c:784:39: note: in expansion of macro 'PG_GETARG_JSQUERY'
784 | JsQuery *jq = PG_GETARG_JSQUERY(0);
| ^~~~~~~~~~~~~~~~~
In file included from jsquery_op.c:15:
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
jsquery_op.c: In function 'json_jsquery_exec':
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_op.c:809:39: note: in expansion of macro 'PG_GETARG_JSQUERY'
809 | JsQuery *jq = PG_GETARG_JSQUERY(1);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
jsquery_op.c: In function 'json_jsquery_filter':
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_op.c:833:39: note: in expansion of macro 'PG_GETARG_JSQUERY'
833 | JsQuery *jq = PG_GETARG_JSQUERY(1);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
jsquery_op.c: In function 'jsquery_cmp':
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_op.c:978:40: note: in expansion of macro 'PG_GETARG_JSQUERY'
978 | JsQuery *jq1 = PG_GETARG_JSQUERY(0);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_op.c:979:40: note: in expansion of macro 'PG_GETARG_JSQUERY'
979 | JsQuery *jq2 = PG_GETARG_JSQUERY(1);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
jsquery_op.c: In function 'jsquery_lt':
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_op.c:998:40: note: in expansion of macro 'PG_GETARG_JSQUERY'
998 | JsQuery *jq1 = PG_GETARG_JSQUERY(0);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_op.c:999:40: note: in expansion of macro 'PG_GETARG_JSQUERY'
999 | JsQuery *jq2 = PG_GETARG_JSQUERY(1);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
jsquery_op.c: In function 'jsquery_le':
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_op.c:1018:40: note: in expansion of macro 'PG_GETARG_JSQUERY'
1018 | JsQuery *jq1 = PG_GETARG_JSQUERY(0);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_op.c:1019:40: note: in expansion of macro 'PG_GETARG_JSQUERY'
1019 | JsQuery *jq2 = PG_GETARG_JSQUERY(1);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
jsquery_op.c: In function 'jsquery_eq':
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_op.c:1038:40: note: in expansion of macro 'PG_GETARG_JSQUERY'
1038 | JsQuery *jq1 = PG_GETARG_JSQUERY(0);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_op.c:1039:40: note: in expansion of macro 'PG_GETARG_JSQUERY'
1039 | JsQuery *jq2 = PG_GETARG_JSQUERY(1);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
jsquery_op.c: In function 'jsquery_ne':
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_op.c:1058:40: note: in expansion of macro 'PG_GETARG_JSQUERY'
1058 | JsQuery *jq1 = PG_GETARG_JSQUERY(0);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_op.c:1059:40: note: in expansion of macro 'PG_GETARG_JSQUERY'
1059 | JsQuery *jq2 = PG_GETARG_JSQUERY(1);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
jsquery_op.c: In function 'jsquery_ge':
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_op.c:1078:40: note: in expansion of macro 'PG_GETARG_JSQUERY'
1078 | JsQuery *jq1 = PG_GETARG_JSQUERY(0);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_op.c:1079:40: note: in expansion of macro 'PG_GETARG_JSQUERY'
1079 | JsQuery *jq2 = PG_GETARG_JSQUERY(1);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
jsquery_op.c: In function 'jsquery_gt':
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_op.c:1098:40: note: in expansion of macro 'PG_GETARG_JSQUERY'
1098 | JsQuery *jq1 = PG_GETARG_JSQUERY(0);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_op.c:1099:40: note: in expansion of macro 'PG_GETARG_JSQUERY'
1099 | JsQuery *jq2 = PG_GETARG_JSQUERY(1);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
jsquery_op.c: In function 'jsquery_hash':
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsquery_op.c:1200:39: note: in expansion of macro 'PG_GETARG_JSQUERY'
1200 | JsQuery *jq = PG_GETARG_JSQUERY(0);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
In file included from /usr/pgsql-16/include/server/access/skey.h:19,
from /usr/pgsql-16/include/server/access/genam.h:18,
from /usr/pgsql-16/include/server/access/amapi.h:15,
from /usr/pgsql-16/include/server/access/hash.h:20,
from jsonb_gin_ops.c:17:
jsonb_gin_ops.c: In function 'gin_debug_query_value_path':
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsonb_gin_ops.c:751:14: note: in expansion of macro 'PG_GETARG_JSQUERY'
751 | jq = PG_GETARG_JSQUERY(0);
| ^~~~~~~~~~~~~~~~~
In file included from jsonb_gin_ops.c:15:
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
jsonb_gin_ops.c: In function 'gin_extract_jsonb_query_value_path':
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsonb_gin_ops.c:795:30: note: in expansion of macro 'PG_GETARG_JSQUERY'
795 | jq = PG_GETARG_JSQUERY(0);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
jsonb_gin_ops.c: In function 'gin_debug_query_path_value':
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsonb_gin_ops.c:1191:14: note: in expansion of macro 'PG_GETARG_JSQUERY'
1191 | jq = PG_GETARG_JSQUERY(0);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
jsonb_gin_ops.c: In function 'gin_extract_jsonb_query_path_value':
/usr/pgsql-16/include/server/fmgr.h:241:9: warning: passing argument 1 of 'DatumGetPointer' makes integer from pointer without a cast [-Wint-conversion]
241 | pg_detoast_datum((struct varlena ) DatumGetPointer(datum))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct varlena *
jsquery.h:28:60: note: in expansion of macro 'PG_DETOAST_DATUM'
28 | #define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
| ^~~~~~~~~~~~~~~~
jsquery.h:29:33: note: in expansion of macro 'DatumGetJsQueryP'
29 | #define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
| ^~~~~~~~~~~~~~~~
jsonb_gin_ops.c:1220:30: note: in expansion of macro 'PG_GETARG_JSQUERY'
1220 | jq = PG_GETARG_JSQUERY(0);
| ^~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'struct varlena *'
312 | DatumGetPointer(Datum X)
| ~~~~~~^
/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 -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o jsquery_extract.bc jsquery_extract.c
/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 -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o jsquery_io.bc jsquery_io.c
/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 -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o jsquery_op.bc jsquery_op.c
/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 -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o jsquery_support.bc jsquery_support.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -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 -fvisibility=hidden -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o jsquery_gram.o jsquery_gram.c
/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 -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o jsquery_gram.bc jsquery_gram.c
jsquery_constr.c:196:18: error: incompatible pointer to integer conversion passing 'struct varlena *' to parameter of type 'Datum' (aka 'unsigned long') [-Wint-conversion]
JsQuery jq1 = PG_GETARG_JSQUERY(0);
^~~~~~~~~~~~~~~~~~~~
./jsquery.h:29:30: note: expanded from macro 'PG_GETARG_JSQUERY'
#define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./jsquery.h:28:56: note: expanded from macro 'DatumGetJsQueryP'
#define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
^~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/fmgr.h:241:2: note: expanded from macro 'PG_DETOAST_DATUM'
pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: passing argument to parameter 'X' here
DatumGetPointer(Datum X)
^
jsquery_constr.c:197:18: error: incompatible pointer to integer conversion passing 'struct varlena *' to parameter of type 'Datum' (aka 'unsigned long') [-Wint-conversion]
JsQuery jq2 = PG_GETARG_JSQUERY(1);
^~~~~~~~~~~~~~~~~~~~
./jsquery.h:29:30: note: expanded from macro 'PG_GETARG_JSQUERY'
#define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./jsquery.h:28:56: note: expanded from macro 'DatumGetJsQueryP'
#define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
^~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/fmgr.h:241:2: note: expanded from macro 'PG_DETOAST_DATUM'
pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: passing argument to parameter 'X' here
DatumGetPointer(Datum X)
^
jsquery_constr.c:212:18: error: incompatible pointer to integer conversion passing 'struct varlena *' to parameter of type 'Datum' (aka 'unsigned long') [-Wint-conversion]
JsQuery jq1 = PG_GETARG_JSQUERY(0);
^~~~~~~~~~~~~~~~~~~~
./jsquery.h:29:30: note: expanded from macro 'PG_GETARG_JSQUERY'
#define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./jsquery.h:28:56: note: expanded from macro 'DatumGetJsQueryP'
#define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
^~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/fmgr.h:241:2: note: expanded from macro 'PG_DETOAST_DATUM'
pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: passing argument to parameter 'X' here
DatumGetPointer(Datum X)
^
jsquery_constr.c:213:18: error: incompatible pointer to integer conversion passing 'struct varlena *' to parameter of type 'Datum' (aka 'unsigned long') [-Wint-conversion]
JsQuery jq2 = PG_GETARG_JSQUERY(1);
^~~~~~~~~~~~~~~~~~~~
./jsquery.h:29:30: note: expanded from macro 'PG_GETARG_JSQUERY'
#define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./jsquery.h:28:56: note: expanded from macro 'DatumGetJsQueryP'
#define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
^~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/fmgr.h:241:2: note: expanded from macro 'PG_DETOAST_DATUM'
pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: passing argument to parameter 'X' here
DatumGetPointer(Datum X)
^
jsquery_constr.c:228:18: error: incompatible pointer to integer conversion passing 'struct varlena *' to parameter of type 'Datum' (aka 'unsigned long') [-Wint-conversion]
JsQuery jq = PG_GETARG_JSQUERY(0);
^~~~~~~~~~~~~~~~~~~~
./jsquery.h:29:30: note: expanded from macro 'PG_GETARG_JSQUERY'
#define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./jsquery.h:28:56: note: expanded from macro 'DatumGetJsQueryP'
#define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
^~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/fmgr.h:241:2: note: expanded from macro 'PG_DETOAST_DATUM'
pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: passing argument to parameter 'X' here
DatumGetPointer(Datum X)
^
5 errors generated.
make[1]: *** [/usr/pgsql-16/lib/pgxs/src/makefiles/../../src/Makefile.global:1080: jsquery_constr.bc] Error 1
make[1]: *** Waiting for unfinished jobs....
jsonb_gin_ops.c:751:7: error: incompatible pointer to integer conversion passing 'struct varlena ' to parameter of type 'Datum' (aka 'unsigned long') [-Wint-conversion]
jq = PG_GETARG_JSQUERY(0);
^~~~~~~~~~~~~~~~~~~~
./jsquery.h:29:30: note: expanded from macro 'PG_GETARG_JSQUERY'
#define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./jsquery.h:28:56: note: expanded from macro 'DatumGetJsQueryP'
#define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
^~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/fmgr.h:241:2: note: expanded from macro 'PG_DETOAST_DATUM'
pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: passing argument to parameter 'X' here
DatumGetPointer(Datum X)
^
jsonb_gin_ops.c:795:9: error: incompatible pointer to integer conversion passing 'struct varlena ' to parameter of type 'Datum' (aka 'unsigned long') [-Wint-conversion]
jq = PG_GETARG_JSQUERY(0);
^~~~~~~~~~~~~~~~~~~~
./jsquery.h:29:30: note: expanded from macro 'PG_GETARG_JSQUERY'
#define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./jsquery.h:28:56: note: expanded from macro 'DatumGetJsQueryP'
#define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
^~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/fmgr.h:241:2: note: expanded from macro 'PG_DETOAST_DATUM'
pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: passing argument to parameter 'X' here
DatumGetPointer(Datum X)
^
jsonb_gin_ops.c:1191:7: error: incompatible pointer to integer conversion passing 'struct varlena ' to parameter of type 'Datum' (aka 'unsigned long') [-Wint-conversion]
jq = PG_GETARG_JSQUERY(0);
^~~~~~~~~~~~~~~~~~~~
./jsquery.h:29:30: note: expanded from macro 'PG_GETARG_JSQUERY'
#define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./jsquery.h:28:56: note: expanded from macro 'DatumGetJsQueryP'
#define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
^~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/fmgr.h:241:2: note: expanded from macro 'PG_DETOAST_DATUM'
pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: passing argument to parameter 'X' here
DatumGetPointer(Datum X)
^
jsonb_gin_ops.c:1220:9: error: incompatible pointer to integer conversion passing 'struct varlena ' to parameter of type 'Datum' (aka 'unsigned long') [-Wint-conversion]
jq = PG_GETARG_JSQUERY(0);
^~~~~~~~~~~~~~~~~~~~
./jsquery.h:29:30: note: expanded from macro 'PG_GETARG_JSQUERY'
#define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./jsquery.h:28:56: note: expanded from macro 'DatumGetJsQueryP'
#define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
^~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/fmgr.h:241:2: note: expanded from macro 'PG_DETOAST_DATUM'
pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: passing argument to parameter 'X' here
DatumGetPointer(Datum X)
^
4 errors generated.
make[1]: *** [/usr/pgsql-16/lib/pgxs/src/makefiles/../../src/Makefile.global:1080: jsonb_gin_ops.bc] Error 1
jsquery_io.c:400:18: error: incompatible pointer to integer conversion passing 'struct varlena *' to parameter of type 'Datum' (aka 'unsigned long') [-Wint-conversion]
JsQuery in = PG_GETARG_JSQUERY(0);
^~~~~~~~~~~~~~~~~~~~
./jsquery.h:29:30: note: expanded from macro 'PG_GETARG_JSQUERY'
#define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./jsquery.h:28:56: note: expanded from macro 'DatumGetJsQueryP'
#define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
^~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/fmgr.h:241:2: note: expanded from macro 'PG_DETOAST_DATUM'
pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: passing argument to parameter 'X' here
DatumGetPointer(Datum X)
^
1 error generated.
make[1]: *** [/usr/pgsql-16/lib/pgxs/src/makefiles/../../src/Makefile.global:1080: jsquery_io.bc] Error 1
jsquery_op.c:784:18: error: incompatible pointer to integer conversion passing 'struct varlena *' to parameter of type 'Datum' (aka 'unsigned long') [-Wint-conversion]
JsQuery jq = PG_GETARG_JSQUERY(0);
^~~~~~~~~~~~~~~~~~~~
./jsquery.h:29:30: note: expanded from macro 'PG_GETARG_JSQUERY'
#define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./jsquery.h:28:56: note: expanded from macro 'DatumGetJsQueryP'
#define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
^~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/fmgr.h:241:2: note: expanded from macro 'PG_DETOAST_DATUM'
pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: passing argument to parameter 'X' here
DatumGetPointer(Datum X)
^
jsquery_op.c:809:18: error: incompatible pointer to integer conversion passing 'struct varlena *' to parameter of type 'Datum' (aka 'unsigned long') [-Wint-conversion]
JsQuery jq = PG_GETARG_JSQUERY(1);
^~~~~~~~~~~~~~~~~~~~
./jsquery.h:29:30: note: expanded from macro 'PG_GETARG_JSQUERY'
#define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./jsquery.h:28:56: note: expanded from macro 'DatumGetJsQueryP'
#define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
^~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/fmgr.h:241:2: note: expanded from macro 'PG_DETOAST_DATUM'
pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: passing argument to parameter 'X' here
DatumGetPointer(Datum X)
^
jsquery_op.c:833:18: error: incompatible pointer to integer conversion passing 'struct varlena *' to parameter of type 'Datum' (aka 'unsigned long') [-Wint-conversion]
JsQuery jq = PG_GETARG_JSQUERY(1);
^~~~~~~~~~~~~~~~~~~~
./jsquery.h:29:30: note: expanded from macro 'PG_GETARG_JSQUERY'
#define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./jsquery.h:28:56: note: expanded from macro 'DatumGetJsQueryP'
#define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
^~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/fmgr.h:241:2: note: expanded from macro 'PG_DETOAST_DATUM'
pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: passing argument to parameter 'X' here
DatumGetPointer(Datum X)
^
jsquery_op.c:978:19: error: incompatible pointer to integer conversion passing 'struct varlena *' to parameter of type 'Datum' (aka 'unsigned long') [-Wint-conversion]
JsQuery jq1 = PG_GETARG_JSQUERY(0);
^~~~~~~~~~~~~~~~~~~~
./jsquery.h:29:30: note: expanded from macro 'PG_GETARG_JSQUERY'
#define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./jsquery.h:28:56: note: expanded from macro 'DatumGetJsQueryP'
#define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
^~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/fmgr.h:241:2: note: expanded from macro 'PG_DETOAST_DATUM'
pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: passing argument to parameter 'X' here
DatumGetPointer(Datum X)
^
jsquery_op.c:979:19: error: incompatible pointer to integer conversion passing 'struct varlena *' to parameter of type 'Datum' (aka 'unsigned long') [-Wint-conversion]
JsQuery jq2 = PG_GETARG_JSQUERY(1);
^~~~~~~~~~~~~~~~~~~~
./jsquery.h:29:30: note: expanded from macro 'PG_GETARG_JSQUERY'
#define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./jsquery.h:28:56: note: expanded from macro 'DatumGetJsQueryP'
#define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
^~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/fmgr.h:241:2: note: expanded from macro 'PG_DETOAST_DATUM'
pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: passing argument to parameter 'X' here
DatumGetPointer(Datum X)
^
jsquery_op.c:998:19: error: incompatible pointer to integer conversion passing 'struct varlena *' to parameter of type 'Datum' (aka 'unsigned long') [-Wint-conversion]
JsQuery jq1 = PG_GETARG_JSQUERY(0);
^~~~~~~~~~~~~~~~~~~~
./jsquery.h:29:30: note: expanded from macro 'PG_GETARG_JSQUERY'
#define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./jsquery.h:28:56: note: expanded from macro 'DatumGetJsQueryP'
#define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
^~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/fmgr.h:241:2: note: expanded from macro 'PG_DETOAST_DATUM'
pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/postgres.h:312:23: note: passing argument to parameter 'X' here
DatumGetPointer(Datum X)
^
jsquery_op.c:999:19: error: incompatible pointer to integer conversion passing 'struct varlena *' to parameter of type 'Datum' (aka 'unsigned long') [-Wint-conversion]
JsQuery jq2 = PG_GETARG_JSQUERY(1);
^~~~~~~~~~~~~~~~~~~~
./jsquery.h:29:30: note: expanded from macro 'PG_GETARG_JSQUERY'
#define PG_GETARG_JSQUERY(x) DatumGetJsQueryP(PG_GETARG_DATUM(x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./jsquery.h:28:56: note: expanded from macro 'DatumGetJsQueryP'
#define DatumGetJsQueryP(d) ((JsQuery
)DatumGetPointer(PG_DETOAST_DATUM(d)))
^~~~~~~~~~~~~~~~~~~

Escaping double quotes

Hi,

how I can escape double quotes in values ?

select * from statements_json t where t.data @@ '"u:ba#title".* ($ = "something  "" '' ")' and t.version is null;

select * from statements_json t where t.data @@ '"u:ba#title".* ($ = "something  \" '' ")' and t.version is null;

For both cases I get:

ERROR: bad jsquery representation Detail: syntax error, unexpected STRING_P, expecting OR_P or AND_P or ')' at or near " "

Any tip how I should escape double quotes in values ? Escaping single quotes is OK, but double quotes are not.

LIKE expressions for string

Hello,
big thx for jsquery!

We need some additional expressions for strings:

"path" LIKE "val%"
"path" ILIKE "%VAL%"

make USE_PGXS=1

Hi
I try to installing jsquery and it fails with the error message
[make USE_PGXS=1](make: *** [/usr/lib/postgresql/16/lib/pgxs/src/makefiles/../../src/Makefile.global:792: jsquery_gram.c] Error 127)

how to select the jsonb value for particular key using JSQuery?

is it possible to select the value for the key in json using JSQuery?

Something like this:
SELECT value @@ (.color) FROM js_test WHERE value @@ '.color = *'

Basically I am interested to see the value of color key in all the json documents if available. My key could be present in any level inside the json.

Thanks.

Ошибка при использовании оператора IN с большим количеством параметров

CREATE TABLE js_test ( js jsonb );

INSERT INTO js_test (js) VALUES ('{"test":[12]}');

SELECT * FROM js_test WHERE js @@ 'test.# IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49)';

Данная серия запросов приводит к тому, что база уходит в recovery mode. Причём, проблема возникает только если количество параметров в IN больше 48.
Надеюсь на вашу помощь.

PostgreSQL 9.6.3 on x86_64-pc-linux-gnu, compiled by gcc (Debian 4.9.2-10) 4.9.2, 64-bit

When Jsquery/VODKA will be "production" ready?

Hey, first of all your work on Postgres is amazing guys!

Do you know (approximately) when Jsquery will be available along with Postgres (9.5, 9.6?). Also could you tell what is actual status of VODKA indexes? Will VODKA indexes also be "merged" to Postgres?

Thanks for your work!

Segmentation fault while casting empty string to jsquery.

Here is steps for issue reproducing.
Every "execute" performs successfully until 6th try.
Reproduced at PostgreSQL version 10.5, jsquery version 1.1.0.

create extension jsquery;

prepare a as (select $1::text::jsquery);

execute a('');
execute a('');
execute a('');
execute a('');
execute a('');
execute a('');

Could not build jsquery

I've tried to build jsquery with 9.4 and 9.5, but it failed with:

jsquery_gram.y:56:5: error: conflicting types for 'jsquery_yyparse'
 int jsquery_yyparse(void *result);
     ^
In file included from jsquery_gram.y:52:0:
jsquery_gram.h:85:5: note: previous declaration of 'jsquery_yyparse' was here
 int jsquery_yyparse (void);
     ^
jsquery_gram.y: In function 'jsquery_yyparse':
jsquery_gram.y:228:29: error: 'result' undeclared (first use in this function)
  expr       { *((JsQueryParseItem**)result) = $1; } 
                             ^
jsquery_gram.y:228:29: note: each undeclared identifier is reported only once for each function it appears in
make: *** [jsquery_gram.o] Error 1

Which version of postgresql || jsquery should i use?

I could help setup travis ci to track build status ( like here https://github.com/fhirbase/fhirbase/blob/master/.travis.yml)

Fatal error install - ubuntu

during installation an error occurs

server:/tmp/jsquery# make USE_PGXS=1
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -I/usr/include/mit-krb5 -fPIC -pie -DLINUX_OOM_SCORE_ADJ=0 -fno-omit-frame-pointer -fpic -I. -I./ -I/usr/include/postgresql/9.4/server -I/usr/include/postgresql/internal -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/tcl8.5  -c -o jsquery_gram.o jsquery_gram.c
jsquery_gram.y:50:26: fatal error: jsquery_gram.h: Нет такого файла или каталога
compilation terminated.
make: *** [jsquery_gram.o] Ошибка 1

query not using gin index

Thank you for a great product. I am having problems where jsquery is not using the gin index.

Given this table and index

 \d vertex
                    Table "public.vertex"
 Column |       Type        | Collation | Nullable | Default
--------+-------------------+-----------+----------+---------
 gid    | character varying |           | not null |
 label  | character varying |           | not null |
 data   | jsonb             |           |          |
Indexes:
    "vertex_data" gin (data)
    "vertex_gid" btree (gid)
    "vertex_label" btree (label)

This standard jsonb query uses index

 explain  select gid, data->'start' as "start", data->'chromosome'  from vertex where label = 'Allele' and data @> '{"start": 35305275}' or data @> '{"start": 35305277}'  ;
                                                             QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------
 Bitmap Heap Scan on vertex  (cost=225.56..36911.68 rows=9623 width=106)
   Recheck Cond: ((data @> '{"start": 35305275}'::jsonb) OR (data @> '{"start": 35305277}'::jsonb))
   Filter: ((((label)::text = 'Allele'::text) AND (data @> '{"start": 35305275}'::jsonb)) OR (data @> '{"start": 35305277}'::jsonb))
   ->  BitmapOr  (cost=225.56..225.56 rows=11300 width=0)
         ->  Bitmap Index Scan on vertex_data  (cost=0.00..110.38 rows=5650 width=0)
               Index Cond: (data @> '{"start": 35305275}'::jsonb)
         ->  Bitmap Index Scan on vertex_data  (cost=0.00..110.38 rows=5650 width=0)
               Index Cond: (data @> '{"start": 35305277}'::jsonb)
(8 rows)

This query does not use the index.

explain select gid, data->'start' as "start", data->'chromosome'  from vertex where label = 'Allele' and data @@ 'start = 35305275 OR start = 35305277'  ;
                                                    QUERY PLAN
------------------------------------------------------------------------------------------------------------------
 Seq Scan on vertex  (cost=0.00..293886.85 rows=3977 width=106)
   Filter: ((data @@ '("start" = 35305275 OR "start" = 35305277)'::jsquery) AND ((label)::text = 'Allele'::text))
(2 rows)


Adding hints does not help

 explain select gid, data->'start' as "start", data->'chromosome'  from vertex where label = 'Allele' and data @@ 'start /*-- index */ = 35305275 OR start /*-- index */ = 35305277'  ;
                                                                   QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------
 Seq Scan on vertex  (cost=0.00..293886.85 rows=3977 width=106)
   Filter: ((data @@ '("start" /*-- index */  = 35305275 OR "start" /*-- index */  = 35305277)'::jsquery) AND ((label)::text = 'Allele'::text))
(2 rows)

I'd really like to use jsquery for queries on the form

explain select gid, data->'start' as "start", data->'chromosome'  from vertex where label = 'Allele' and data @@ 'start ($ > 35305274 AND $ < 35305278) ';
                                                  QUERY PLAN
--------------------------------------------------------------------------------------------------------------
 Seq Scan on vertex  (cost=0.00..293886.85 rows=3977 width=106)
   Filter: ((data @@ '"start"($ > 35305275 AND $ < 35305277)'::jsquery) AND ((label)::text = 'Allele'::text))
(2 rows)

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.