mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
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
34 lines
772 B
PL/PgSQL
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);
|