1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-11 10:01:57 +03:00
Files
postgres/src/pl/plpython/sql/plpython_quote.sql
Andres Freund db23464715 plpython: Remove regression test infrastructure for Python 2.
Since 19252e8ec9 we reject Python 2 during build configuration. Now that the
dust on the buildfarm has settled, remove regression testing infrastructure
dealing with differing output between Python 2 / 3.

Reviewed-By: Peter Eisentraut <peter@eisentraut.org>
Reviewed-By: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/20211031184548.g4sxfe47n2kyi55r@alap3.anarazel.de
2022-03-07 18:20:51 -08:00

34 lines
772 B
PL/PgSQL

-- test quoting functions
CREATE FUNCTION quote(t text, how text) RETURNS text AS $$
if how == "literal":
return plpy.quote_literal(t)
elif how == "nullable":
return plpy.quote_nullable(t)
elif how == "ident":
return plpy.quote_ident(t)
else:
raise plpy.Error("unrecognized quote type %s" % how)
$$ LANGUAGE plpython3u;
SELECT quote(t, 'literal') FROM (VALUES
('abc'),
('a''bc'),
('''abc'''),
(''),
(''''),
('xyzv')) AS v(t);
SELECT quote(t, 'nullable') FROM (VALUES
('abc'),
('a''bc'),
('''abc'''),
(''),
(''''),
(NULL)) AS v(t);
SELECT quote(t, 'ident') FROM (VALUES
('abc'),
('a b c'),
('a " ''abc''')) AS v(t);