public inbox for [email protected]  
help / color / mirror / Atom feed
From: Adrian Klaver <[email protected]>
To: Marcos Pegoraro <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: Trying to understand pg_get_expr()
Date: Tue, 17 Mar 2026 13:36:34 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAB-JLwbwKi6q_fG7ByGRJe-L+m9Nx+WHiTP0qhEw7qKzv37QQA@mail.gmail.com>
References: <[email protected]>
	<CAB-JLwZdyUfnC047MzV9woskWH2dToNJEudR34AD8WprEn8Cig@mail.gmail.com>
	<[email protected]>
	<CAB-JLwbwKi6q_fG7ByGRJe-L+m9Nx+WHiTP0qhEw7qKzv37QQA@mail.gmail.com>

On 3/17/26 1:26 PM, Marcos Pegoraro wrote:
> Em ter., 17 de mar. de 2026 às 17:19, Adrian Klaver 
> <[email protected] <mailto:[email protected]>> escreveu:
> 
>     I also tried other combinations of casting both sides of "=" and it
>     still did not work.
> 
> 
> "'test'::character varying" is the result of that function, not type of test
> This should work
> AND pg_get_expr(adbin, adrelid) = $$'test'::character varying$$;

Yeah that worked.

It begs the question then, in:

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

Why is the second case not?:

'0'::integer

> 
> regards
> Marcos
> 


-- 
Adrian Klaver
[email protected]






reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Trying to understand pg_get_expr()
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox