dubious warning: FORMAT JSON has no effect for json and jsonb types

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: dubious warning: FORMAT JSON has no effect for json and jsonb types
Date: 2023-08-16 13:54:57
Message-ID: dfec2cae-d17e-c508-6d16-c2dba82db486@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

This warning comes from parse_expr.c transformJsonValueExpr() and is
triggered for example by the following test case:

SELECT JSON_OBJECT('foo': NULL::json FORMAT JSON);
WARNING: FORMAT JSON has no effect for json and jsonb types

But I don't see anything in the SQL standard that would require this
warning. It seems pretty clear that FORMAT JSON in this case is
implicit and otherwise without effect.

Also, we don't have that warning in the output case (RETURNING json
FORMAT JSON).

Anyone remember why this is here? Should we remove it?

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Önder Kalacı 2023-08-16 13:58:29 Re: postgres_fdw: wrong results with self join + enable_nestloop off
Previous Message Peter Eisentraut 2023-08-16 13:50:09 Re: Handle infinite recursion in logical replication setup