public inbox for [email protected]
help / color / mirror / Atom feedTrying to understand pg_get_expr()
2+ messages / 2 participants
[nested] [flat]
* Trying to understand pg_get_expr()
@ 2026-03-17 19:31 Adrian Klaver <[email protected]>
2026-03-17 20:08 ` Re: Trying to understand pg_get_expr() Marcos Pegoraro <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Adrian Klaver @ 2026-03-17 19:31 UTC (permalink / raw)
To: pgsql-general
Given:
select version();
version
-----------------------------------------------
PostgreSQL 17.9 (Ubuntu 17.9-1.pgdg24.04+1)
and:
CREATE TABLE default_test (
id integer,
fld_1 varchar DEFAULT 'test',
fld_2 integer DEFAULT 0
);
Then:
SELECT
adrelid::regclass,
pg_typeof(pg_get_expr(adbin, adrelid)),
pg_get_expr(adbin, adrelid)
FROM
pg_attrdef
WHERE
adrelid = 'default_test'::regclass;
adrelid | pg_typeof | pg_get_expr
--------------+-----------+---------------------------
default_test | text | 'test'::character varying
default_test | text | 0
and:
SELECT
adrelid::regclass,
pg_typeof(pg_get_expr(adbin, adrelid)),
pg_get_expr(adbin, adrelid)
FROM
pg_attrdef
WHERE
adrelid = 'default_test'::regclass
AND pg_get_expr(adbin, adrelid) = '0';
adrelid | pg_typeof | pg_get_expr
--------------+-----------+-------------
default_test | text | 0
SELECT
adrelid::regclass,
pg_typeof(pg_get_expr(adbin, adrelid)),
pg_get_expr(adbin, adrelid)
FROM
pg_attrdef
WHERE
adrelid = 'default_test'::regclass
AND pg_get_expr(adbin, adrelid) = 'test';
adrelid | pg_typeof | pg_get_expr
---------+-----------+-------------
(0 rows)
Why does the = 'test' not return anything?
--
Adrian Klaver
[email protected]
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Trying to understand pg_get_expr()
2026-03-17 19:31 Trying to understand pg_get_expr() Adrian Klaver <[email protected]>
@ 2026-03-17 20:08 ` Marcos Pegoraro <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Marcos Pegoraro @ 2026-03-17 20:08 UTC (permalink / raw)
To: Adrian Klaver <[email protected]>; +Cc: pgsql-general
Em ter., 17 de mar. de 2026 às 16:31, Adrian Klaver <
[email protected]> escreveu:
> Why does the = 'test' not return anything?
for me pg_get_expr(adbin, adrelid) returns 'test'::character varying
so it differs from 'test'
regards
Marcos
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-03-17 20:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-03-17 19:31 Trying to understand pg_get_expr() Adrian Klaver <[email protected]>
2026-03-17 20:08 ` Marcos Pegoraro <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox