Make LANGUAGE SQL the default

Started by Peter Eisentrautalmost 6 years ago3 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t43067
psql -h localhost -U postgres

Built from patchset v1 (message #1), July 27, 2026 at 06:20 PM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t43067_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t43067_1 && git checkout t43067_1

Patchset v1 (message #1) is on t43067_1

Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

A sub-patch extracted from the bigger patch in thread "SQL-standard
function body"[0]/messages/by-id/1c11f1eb-f00c-43b7-799d-2d44132c02d7@2ndquadrant.com: Make LANGUAGE SQL the default in CREATE FUNCTION and
CREATE PROCEDURE, per SQL standard.

[0]: /messages/by-id/1c11f1eb-f00c-43b7-799d-2d44132c02d7@2ndquadrant.com
/messages/by-id/1c11f1eb-f00c-43b7-799d-2d44132c02d7@2ndquadrant.com

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

t43067_1
0001-Make-LANGUAGE-SQL-the-default.patchtext/plain; charset=UTF-8; name=0001-Make-LANGUAGE-SQL-the-default.patch; x-mac-creator=0; x-mac-type=0Download+12-18
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#1)
Re: Make LANGUAGE SQL the default

Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:

A sub-patch extracted from the bigger patch in thread "SQL-standard
function body"[0]: Make LANGUAGE SQL the default in CREATE FUNCTION and
CREATE PROCEDURE, per SQL standard.

I'm suspicious of doing this, mainly because DO does not have that
default. I think sticking with no-default is less likely to cause
confusion. Moreover, I don't really believe that having a default value
here is going to add any noticeable ease-of-use for anyone. What's much
more likely to happen is that we'll start getting novice questions about
whatever weird syntax errors you get when trying to feed plpgsql code to
the sql-language function parser. (I don't know what they are exactly,
but I'll bet a very fine dinner that they're less understandable to a
novice than "no language specified".)

I don't see any reason why we can't figure out that an unquoted function
body is SQL, while continuing to make no assumptions about a body written
as a string. The argument that defaulting to SQL makes the latter case
SQL-compliant seems pretty silly anyway.

I also continue to suspect that we are going to need to treat quoted
and unquoted SQL as two different languages, possibly with not even
the same semantics. If that's how things shake out, claiming that the
quoted-SQL version is the default because spec becomes even sillier.

regards, tom lane

#3Pavel Stehule
pavel.stehule@gmail.com
In reply to: Tom Lane (#2)
Re: Make LANGUAGE SQL the default

so 10. 10. 2020 v 18:14 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:

Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:

A sub-patch extracted from the bigger patch in thread "SQL-standard
function body"[0]: Make LANGUAGE SQL the default in CREATE FUNCTION and
CREATE PROCEDURE, per SQL standard.

I'm suspicious of doing this, mainly because DO does not have that
default. I think sticking with no-default is less likely to cause
confusion. Moreover, I don't really believe that having a default value
here is going to add any noticeable ease-of-use for anyone. What's much
more likely to happen is that we'll start getting novice questions about
whatever weird syntax errors you get when trying to feed plpgsql code to
the sql-language function parser. (I don't know what they are exactly,
but I'll bet a very fine dinner that they're less understandable to a
novice than "no language specified".)

I don't see any reason why we can't figure out that an unquoted function
body is SQL, while continuing to make no assumptions about a body written
as a string. The argument that defaulting to SQL makes the latter case
SQL-compliant seems pretty silly anyway.

+1

Pavel

Show quoted text

I also continue to suspect that we are going to need to treat quoted
and unquoted SQL as two different languages, possibly with not even
the same semantics. If that's how things shake out, claiming that the
quoted-SQL version is the default because spec becomes even sillier.

regards, tom lane