1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-25 20:23:07 +03:00

Add pg_typeof() function.

Brendan Jurd
This commit is contained in:
Tom Lane
2008-11-03 17:51:13 +00:00
parent 06c22d7f51
commit b8fab2411d
7 changed files with 100 additions and 7 deletions

View File

@@ -469,3 +469,14 @@ select formarray(1, 'x'::text); -- fail, type mismatch
select formarray(1, variadic array['x'::text]); -- fail, type mismatch
drop function formarray(anyelement, variadic anyarray);
-- test pg_typeof() function
select pg_typeof(null); -- unknown
select pg_typeof(0); -- integer
select pg_typeof(0.0); -- numeric
select pg_typeof(1+1 = 2); -- boolean
select pg_typeof('x'); -- unknown
select pg_typeof('' || ''); -- text
select pg_typeof(pg_typeof(0)); -- regtype
select pg_typeof(array[1.2,55.5]); -- numeric[]
select pg_typeof(myleast(10, 1, 20, 33)); -- polymorphic input