Home > Net >  What does double question mark (??) mean in sql (postgres sql)
What does double question mark (??) mean in sql (postgres sql)

Time:12-22

What does double question mark (??) mean in sql or sql query. (postgres sql).

My DB Server is Postgres and I am using columns that are of type jsonb.

I see a query that has ?? in it. Below is the query.

select rr.jdoc 
from table_with_jsonb rr 
where not (rr.jdoc ?? 'pivot')  
  and ((rr.jdoc->'mapping'->>'objectType')<>'meta');

Can some one explain what the ?? means and any references will be of great help.

Normally my understand is that - ? is to allow Parameterized Query.
But this table 9.4 ref -> FUNCTIONS-JSONB-OP-TABLE or 13.x ref -> FUNCTIONS-JSONB-OP-TABLE adds more usage scenerios for ?. But still it does not say what ?? is.

PS: Plz ignore the doc references to 9.4. I am using 13.x currently.

CodePudding user response:

It's the same as the ? operator when used through JDBC.

JDBC uses ? for parameter placeholders and thus there needs to be a way to distinguish the operator from the parameter placeholder. So the Postgres JDBC driver allows to escape the ? operator using ?? in a PreparedStatement.

I don't know if other technologies (ODBC, .Net) are using a similar mechanism.

  • Related