More formatting issues with SQL
hightligh.js has proper support for PostgreSQL and PL/pgSQL.
Still, my code is messed up on a regular basis. Like in this example (I ended up with a workaround using dollar-quoting to keep it readable - which is also not recognized, although it should be):
Using pgsql
as format specifier does not seem to have any effect. Seems like you removed that somehow? Falling back to sql
is a poor substitute:
CREATE OR REPLACE FUNCTION return_result_table(_param1 integer[], _param2 text[]) RETURNS text LANGUAGE plpgsql AS$func$DECLARE _table_name text := to_char(current_date, '"_XYZABC_"YYYY_MM_DD"_ZXCVBN"'); _select text := '(select * from some_other_function($1, $2))'; -- !BEGIN EXECUTE format('CREATE TABLE some_schema.%I AS ', _table_name) || _select USING _param1, _param2; RETURN _table_name; END$func$;
Can this be fixed?
This is particularly unfortunate as I am currently hard-coding the format specifier sql
, which should later be pgsql
once the issue is fixed. Or what's the best workaround for now?
Update: I settled with tagging pgsql
for now. That seems to be ignored, currently. So formatting falls back to the language determined automatically (currently mostly sql
for Postgres questions, I assume). Once pgsql
is fixed, the format specifier will kick in correctly.
It will be fixed, eventually, or will it not?
In case you are unfamiliar with dollar-quoting in Postgres: