Adrian Klaver <[email protected]> writes:
> On 10/31/26 3:04 PM, Igor Korot wrote:
>> I have a schema name as a string.
>> Should I cast that value to something when I write
>> "pg_class.relnamespace = 'public'"?

> select relname from pg_catalog.pg_class where relname = 'cell_per' and 
> relnamespace = 'public'::regnamespace;

Given that the original requirement was

>>> SELECT attnum FROM pg_attribute WHERE attrelid = 'my_table_name';

maybe just

SELECT attnum FROM pg_attribute
  WHERE attrelid = 'my_schema_name.my_table_name'::regclass;

?  But doing the joins explicitly is probably more adaptable
to more-complex cases.

                        regards, tom lane


Reply via email to