Please, understand that I am totally new to Postgresql. I am having trouble testing queries in client tools like pgAdmin and DBeaver.
This works:
select *
FROM pg_tables
WHERE schemaname = 'schema_name'
AND tablename = 'table_name'
But not this:
RAISE NOTICE 'Hi' ;
I also can't run anything with an "if" statement. I have years of experience with SSMS, and so I expect to be able to run statements like this. Am I using the tool wrong or are they just not capable of these types of statements? Thank you.
Thank you to @a_horse_with_no_name. I needed to be using a do block.
DO $$
BEGIN
RAISE NOTICE 'my message';
END; $$;
DO $$
begin
IF EXISTS (SELECT FROM pg_tables WHERE schemaname = 'schema_name' AND tablename = 'table_name') then
RAISE NOTICE 'exists' ;
ELSE
RAISE NOTICE 'not exists' ;
end IF;
END; $$;