@@ -1657,105 +1657,105 @@ SELECT * FROM check_test(
16571657-- Test hasnt_leftop().
16581658
16591659SELECT * FROM check_test(
1660- hasnt_leftop( ' pg_catalog' , ' !! ' , ' bigint' , ' numeric ' , ' desc' ),
1660+ hasnt_leftop( ' pg_catalog' , ' + ' , ' bigint' , ' bigint ' , ' desc' ),
16611661 false,
16621662 ' hasnt_leftop( schema, name, right, result, desc ) fail' ,
16631663 ' desc' ,
16641664 ' '
16651665);
16661666
16671667SELECT * FROM check_test(
1668- hasnt_leftop( ' pg_catalog' , ' !! ' , ' bigint' , ' numeric ' ::name ),
1668+ hasnt_leftop( ' pg_catalog' , ' + ' , ' bigint' , ' bigint ' ::name ),
16691669 false,
16701670 ' hasnt_leftop( schema, name, right, result ) fail' ,
1671- ' Left operator pg_catalog.!! (NONE,bigint) RETURNS numeric should not exist' ,
1671+ ' Left operator pg_catalog.+ (NONE,bigint) RETURNS bigint should not exist' ,
16721672 ' '
16731673);
16741674
16751675SELECT * FROM check_test(
1676- hasnt_leftop( ' !! ' , ' bigint' , ' numeric ' , ' desc' ),
1676+ hasnt_leftop( ' + ' , ' bigint' , ' bigint ' , ' desc' ),
16771677 false,
16781678 ' hasnt_leftop( name, right, result, desc ) fail' ,
16791679 ' desc' ,
16801680 ' '
16811681);
16821682
16831683SELECT * FROM check_test(
1684- hasnt_leftop( ' !! ' , ' bigint' , ' numeric ' ::name ),
1684+ hasnt_leftop( ' + ' , ' bigint' , ' bigint ' ::name ),
16851685 false,
16861686 ' hasnt_leftop( name, right, result ) fail' ,
1687- ' Left operator !! (NONE,bigint) RETURNS numeric should not exist' ,
1687+ ' Left operator + (NONE,bigint) RETURNS bigint should not exist' ,
16881688 ' '
16891689);
16901690
16911691SELECT * FROM check_test(
1692- hasnt_leftop( ' !! ' , ' bigint' , ' desc' ),
1692+ hasnt_leftop( ' + ' , ' bigint' , ' desc' ),
16931693 false,
16941694 ' hasnt_leftop( name, right, desc ) fail' ,
16951695 ' desc' ,
16961696 ' '
16971697);
16981698
16991699SELECT * FROM check_test(
1700- hasnt_leftop( ' !! ' , ' bigint' ),
1700+ hasnt_leftop( ' + ' , ' bigint' ),
17011701 false,
17021702 ' hasnt_leftop( name, right ) fail' ,
1703- ' Left operator !! (NONE,bigint) should not exist' ,
1703+ ' Left operator + (NONE,bigint) should not exist' ,
17041704 ' '
17051705);
17061706
17071707SELECT * FROM check_test(
1708- hasnt_leftop( ' pg_catalog' , ' !! ' , ' text' , ' numeric ' , ' desc' ),
1708+ hasnt_leftop( ' pg_catalog' , ' + ' , ' text' , ' bigint ' , ' desc' ),
17091709 true,
17101710 ' hasnt_leftop( schema, name, right, result, desc )' ,
17111711 ' desc' ,
17121712 ' '
17131713);
17141714
17151715SELECT * FROM check_test(
1716- hasnt_leftop( ' pg_catalog' , ' !! ' , ' text' , ' numeric ' ::name ),
1716+ hasnt_leftop( ' pg_catalog' , ' + ' , ' text' , ' bigint ' ::name ),
17171717 true,
17181718 ' hasnt_leftop( schema, name, right, result )' ,
1719- ' Left operator pg_catalog.!! (NONE,text) RETURNS numeric should not exist' ,
1719+ ' Left operator pg_catalog.+ (NONE,text) RETURNS bigint should not exist' ,
17201720 ' '
17211721);
17221722
17231723SELECT * FROM check_test(
1724- hasnt_leftop( ' !! ' , ' text' , ' numeric ' , ' desc' ),
1724+ hasnt_leftop( ' + ' , ' text' , ' bigint ' , ' desc' ),
17251725 true,
17261726 ' hasnt_leftop( name, right, result, desc )' ,
17271727 ' desc' ,
17281728 ' '
17291729);
17301730
17311731SELECT * FROM check_test(
1732- hasnt_leftop( ' !! ' , ' text' , ' numeric ' ::name ),
1732+ hasnt_leftop( ' + ' , ' text' , ' bigint ' ::name ),
17331733 true,
17341734 ' hasnt_leftop( name, right, result )' ,
1735- ' Left operator !! (NONE,text) RETURNS numeric should not exist' ,
1735+ ' Left operator + (NONE,text) RETURNS bigint should not exist' ,
17361736 ' '
17371737);
17381738
17391739SELECT * FROM check_test(
1740- hasnt_leftop( ' !! ' , ' text' , ' desc' ),
1740+ hasnt_leftop( ' + ' , ' text' , ' desc' ),
17411741 true,
17421742 ' hasnt_leftop( name, right, desc )' ,
17431743 ' desc' ,
17441744 ' '
17451745);
17461746
17471747SELECT * FROM check_test(
1748- hasnt_leftop( ' !! ' , ' text' ),
1748+ hasnt_leftop( ' + ' , ' text' ),
17491749 true,
17501750 ' hasnt_leftop( name, right )' ,
1751- ' Left operator !! (NONE,text) should not exist' ,
1751+ ' Left operator + (NONE,text) should not exist' ,
17521752 ' '
17531753);
17541754
17551755/* ***************************************************************************/
17561756-- Test has_rightop().
17571757
1758- CREATE FUNCTION test_rightop () RETURNS SETOF TEXT LANGUAGE plpgsql AS $$
1758+ CREATE FUNCTION test_has_rightop () RETURNS SETOF TEXT LANGUAGE plpgsql AS $$
17591759DECLARE
17601760 tap record;
17611761BEGIN
@@ -1857,7 +1857,7 @@ BEGIN
18571857 ) AS b LOOP RETURN NEXT tap .b ; END LOOP;
18581858 ELSE
18591859 -- PostgreSQL 14 dropped support for postfix operators, so mock the
1860- -- output for the test to pass.
1860+ -- output for the tests to pass.
18611861 FOR tap IN SELECT * FROM (VALUES
18621862 (' has_rightop( left, schema, name, result, desc ) should pass' ),
18631863 (' has_rightop( left, schema, name, result, desc ) should have the proper description' ),
@@ -1899,107 +1899,156 @@ BEGIN
18991899 END IF;
19001900END;
19011901$$;
1902- SELECT * FROM test_rightop();
1903-
1902+ SELECT * FROM test_has_rightop();
19041903
19051904/* ***************************************************************************/
19061905-- Test hasnt_rightop().
19071906
1908- SELECT * FROM check_test(
1909- hasnt_rightop( ' bigint' , ' pg_catalog' , ' !' , ' numeric' , ' desc' ),
1910- false,
1911- ' hasnt_rightop( left, schema, name, result, desc ) fail' ,
1912- ' desc' ,
1913- ' '
1914- );
1907+ CREATE FUNCTION test_hasnt_rightop () RETURNS SETOF TEXT LANGUAGE plpgsql AS $$
1908+ DECLARE
1909+ tap record;
1910+ BEGIN
1911+ IF pg_version_num() < 140000 THEN
1912+ FOR tap IN SELECT * FROM check_test(
1913+ hasnt_rightop( ' bigint' , ' pg_catalog' , ' !' , ' numeric' , ' desc' ),
1914+ false,
1915+ ' hasnt_rightop( left, schema, name, result, desc ) fail' ,
1916+ ' desc' ,
1917+ ' '
1918+ ) AS b LOOP RETURN NEXT tap .b ; END LOOP;
19151919
1916- SELECT * FROM check_test(
1917- hasnt_rightop( ' bigint' , ' pg_catalog' , ' !' , ' numeric' ::name ),
1918- false,
1919- ' hasnt_rightop( left, schema, name, result ) fail' ,
1920- ' Right operator pg_catalog.!(bigint,NONE) RETURNS numeric should not exist' ,
1921- ' '
1922- ) ;
1920+ FOR tap IN SELECT * FROM check_test(
1921+ hasnt_rightop( ' bigint' , ' pg_catalog' , ' !' , ' numeric' ::name ),
1922+ false,
1923+ ' hasnt_rightop( left, schema, name, result ) fail' ,
1924+ ' Right operator pg_catalog.!(bigint,NONE) RETURNS numeric should not exist' ,
1925+ ' '
1926+ ) AS b LOOP RETURN NEXT tap . b ; END LOOP ;
19231927
1924- SELECT * FROM check_test(
1925- hasnt_rightop( ' bigint' , ' !' , ' numeric' , ' desc' ),
1926- false,
1927- ' hasnt_rightop( left, name, result, desc ) fail' ,
1928- ' desc' ,
1929- ' '
1930- ) ;
1928+ FOR tap IN SELECT * FROM check_test(
1929+ hasnt_rightop( ' bigint' , ' !' , ' numeric' , ' desc' ),
1930+ false,
1931+ ' hasnt_rightop( left, name, result, desc ) fail' ,
1932+ ' desc' ,
1933+ ' '
1934+ ) AS b LOOP RETURN NEXT tap . b ; END LOOP ;
19311935
1932- SELECT * FROM check_test(
1933- hasnt_rightop( ' bigint' , ' !' , ' numeric' ::name ),
1934- false,
1935- ' hasnt_rightop( left, name, result ) fail' ,
1936- ' Right operator !(bigint,NONE) RETURNS numeric should not exist' ,
1937- ' '
1938- ) ;
1936+ FOR tap IN SELECT * FROM check_test(
1937+ hasnt_rightop( ' bigint' , ' !' , ' numeric' ::name ),
1938+ false,
1939+ ' hasnt_rightop( left, name, result ) fail' ,
1940+ ' Right operator !(bigint,NONE) RETURNS numeric should not exist' ,
1941+ ' '
1942+ ) AS b LOOP RETURN NEXT tap . b ; END LOOP ;
19391943
1940- SELECT * FROM check_test(
1941- hasnt_rightop( ' bigint' , ' !' , ' desc' ),
1942- false,
1943- ' hasnt_rightop( left, name, desc ) fail' ,
1944- ' desc' ,
1945- ' '
1946- ) ;
1944+ FOR tap IN SELECT * FROM check_test(
1945+ hasnt_rightop( ' bigint' , ' !' , ' desc' ),
1946+ false,
1947+ ' hasnt_rightop( left, name, desc ) fail' ,
1948+ ' desc' ,
1949+ ' '
1950+ ) AS b LOOP RETURN NEXT tap . b ; END LOOP ;
19471951
1948- SELECT * FROM check_test(
1949- hasnt_rightop( ' bigint' , ' !' ),
1950- false,
1951- ' hasnt_rightop( left, name ) fail' ,
1952- ' Right operator !(bigint,NONE) should not exist' ,
1953- ' '
1954- ) ;
1952+ FOR tap IN SELECT * FROM check_test(
1953+ hasnt_rightop( ' bigint' , ' !' ),
1954+ false,
1955+ ' hasnt_rightop( left, name ) fail' ,
1956+ ' Right operator !(bigint,NONE) should not exist' ,
1957+ ' '
1958+ ) AS b LOOP RETURN NEXT tap . b ; END LOOP ;
19551959
1956- SELECT * FROM check_test(
1957- hasnt_rightop( ' text' , ' pg_catalog' , ' !' , ' numeric' , ' desc' ),
1958- true,
1959- ' hasnt_rightop( left, schema, name, result, desc )' ,
1960- ' desc' ,
1961- ' '
1962- ) ;
1960+ FOR tap IN SELECT * FROM check_test(
1961+ hasnt_rightop( ' text' , ' pg_catalog' , ' !' , ' numeric' , ' desc' ),
1962+ true,
1963+ ' hasnt_rightop( left, schema, name, result, desc )' ,
1964+ ' desc' ,
1965+ ' '
1966+ ) AS b LOOP RETURN NEXT tap . b ; END LOOP ;
19631967
1964- SELECT * FROM check_test(
1965- hasnt_rightop( ' text' , ' pg_catalog' , ' !' , ' numeric' ::name ),
1966- true,
1967- ' hasnt_rightop( left, schema, name, result )' ,
1968- ' Right operator pg_catalog.!(text,NONE) RETURNS numeric should not exist' ,
1969- ' '
1970- ) ;
1968+ FOR tap IN SELECT * FROM check_test(
1969+ hasnt_rightop( ' text' , ' pg_catalog' , ' !' , ' numeric' ::name ),
1970+ true,
1971+ ' hasnt_rightop( left, schema, name, result )' ,
1972+ ' Right operator pg_catalog.!(text,NONE) RETURNS numeric should not exist' ,
1973+ ' '
1974+ ) AS b LOOP RETURN NEXT tap . b ; END LOOP ;
19711975
1972- SELECT * FROM check_test(
1973- hasnt_rightop( ' text' , ' !' , ' numeric' , ' desc' ),
1974- true,
1975- ' hasnt_rightop( left, name, result, desc )' ,
1976- ' desc' ,
1977- ' '
1978- ) ;
1976+ FOR tap IN SELECT * FROM check_test(
1977+ hasnt_rightop( ' text' , ' !' , ' numeric' , ' desc' ),
1978+ true,
1979+ ' hasnt_rightop( left, name, result, desc )' ,
1980+ ' desc' ,
1981+ ' '
1982+ ) AS b LOOP RETURN NEXT tap . b ; END LOOP ;
19791983
1980- SELECT * FROM check_test(
1981- hasnt_rightop( ' text' , ' !' , ' numeric' ::name ),
1982- true,
1983- ' hasnt_rightop( left, name, result )' ,
1984- ' Right operator !(text,NONE) RETURNS numeric should not exist' ,
1985- ' '
1986- ) ;
1984+ FOR tap IN SELECT * FROM check_test(
1985+ hasnt_rightop( ' text' , ' !' , ' numeric' ::name ),
1986+ true,
1987+ ' hasnt_rightop( left, name, result )' ,
1988+ ' Right operator !(text,NONE) RETURNS numeric should not exist' ,
1989+ ' '
1990+ ) AS b LOOP RETURN NEXT tap . b ; END LOOP ;
19871991
1988- SELECT * FROM check_test(
1989- hasnt_rightop( ' text' , ' !' , ' desc' ),
1990- true,
1991- ' hasnt_rightop( left, name, desc )' ,
1992- ' desc' ,
1993- ' '
1994- ) ;
1992+ FOR tap IN SELECT * FROM check_test(
1993+ hasnt_rightop( ' text' , ' !' , ' desc' ),
1994+ true,
1995+ ' hasnt_rightop( left, name, desc )' ,
1996+ ' desc' ,
1997+ ' '
1998+ ) AS b LOOP RETURN NEXT tap . b ; END LOOP ;
19951999
1996- SELECT * FROM check_test(
1997- hasnt_rightop( ' text' , ' !' ),
1998- true,
1999- ' hasnt_rightop( left, name )' ,
2000- ' Right operator !(text,NONE) should not exist' ,
2001- ' '
2002- );
2000+ FOR tap IN SELECT * FROM check_test(
2001+ hasnt_rightop( ' text' , ' !' ),
2002+ true,
2003+ ' hasnt_rightop( left, name )' ,
2004+ ' Right operator !(text,NONE) should not exist' ,
2005+ ' '
2006+ ) AS b LOOP RETURN NEXT tap .b ; END LOOP;
2007+ ELSE
2008+ -- PostgreSQL 14 dropped support for postfix operators, so mock the
2009+ -- output for the tests to pass.
2010+ FOR tap IN SELECT * FROM (VALUES
2011+ (' hasnt_rightop( left, schema, name, result, desc ) fail should fail' ),
2012+ (' hasnt_rightop( left, schema, name, result, desc ) fail should have the proper description' ),
2013+ (' hasnt_rightop( left, schema, name, result, desc ) fail should have the proper diagnostics' ),
2014+ (' hasnt_rightop( left, schema, name, result ) fail should fail' ),
2015+ (' hasnt_rightop( left, schema, name, result ) fail should have the proper description' ),
2016+ (' hasnt_rightop( left, schema, name, result ) fail should have the proper diagnostics' ),
2017+ (' hasnt_rightop( left, name, result, desc ) fail should fail' ),
2018+ (' hasnt_rightop( left, name, result, desc ) fail should have the proper description' ),
2019+ (' hasnt_rightop( left, name, result, desc ) fail should have the proper diagnostics' ),
2020+ (' hasnt_rightop( left, name, result ) fail should fail' ),
2021+ (' hasnt_rightop( left, name, result ) fail should have the proper description' ),
2022+ (' hasnt_rightop( left, name, result ) fail should have the proper diagnostics' ),
2023+ (' hasnt_rightop( left, name, desc ) fail should fail' ),
2024+ (' hasnt_rightop( left, name, desc ) fail should have the proper description' ),
2025+ (' hasnt_rightop( left, name, desc ) fail should have the proper diagnostics' ),
2026+ (' hasnt_rightop( left, name ) fail should fail' ),
2027+ (' hasnt_rightop( left, name ) fail should have the proper description' ),
2028+ (' hasnt_rightop( left, name ) fail should have the proper diagnostics' ),
2029+ (' hasnt_rightop( left, schema, name, result, desc ) should pass' ),
2030+ (' hasnt_rightop( left, schema, name, result, desc ) should have the proper description' ),
2031+ (' hasnt_rightop( left, schema, name, result, desc ) should have the proper diagnostics' ),
2032+ (' hasnt_rightop( left, schema, name, result ) should pass' ),
2033+ (' hasnt_rightop( left, schema, name, result ) should have the proper description' ),
2034+ (' hasnt_rightop( left, schema, name, result ) should have the proper diagnostics' ),
2035+ (' hasnt_rightop( left, name, result, desc ) should pass' ),
2036+ (' hasnt_rightop( left, name, result, desc ) should have the proper description' ),
2037+ (' hasnt_rightop( left, name, result, desc ) should have the proper diagnostics' ),
2038+ (' hasnt_rightop( left, name, result ) should pass' ),
2039+ (' hasnt_rightop( left, name, result ) should have the proper description' ),
2040+ (' hasnt_rightop( left, name, result ) should have the proper diagnostics' ),
2041+ (' hasnt_rightop( left, name, desc ) should pass' ),
2042+ (' hasnt_rightop( left, name, desc ) should have the proper description' ),
2043+ (' hasnt_rightop( left, name, desc ) should have the proper diagnostics' ),
2044+ (' hasnt_rightop( left, name ) should pass' ),
2045+ (' hasnt_rightop( left, name ) should have the proper description' ),
2046+ (' hasnt_rightop( left, name ) should have the proper diagnostics' )
2047+ ) AS A(b) LOOP RETURN NEXT pass(tap .b ); END LOOP;
2048+ END IF;
2049+ END;
2050+ $$;
2051+ SELECT * FROM test_hasnt_rightop();
20032052
20042053/* ***************************************************************************/
20052054-- Test has_language() and hasnt_language().
0 commit comments