Is it possible to print to either the console window or the output window when debugging Postgres SQL using DBeaver?
If so...HOW? Thanks!
You can use in your code:
RAISE NOTICE 'log value %', value ;
or other debug print and view in "Output" window in DBeaver (second from the bottom icon in the left sql editor panel)
You can debug the poor mans way with a Table called PrintOut and a column called messages:
do $$
declare
ppllastActivity date;
BEGIN
SELECT lastactivity into ppllastActivity FROM People WHERE email = '[email protected]';
IF COALESCE (ppllastActivity, '1900-01-01') = '1900-01-01' THEN
INSERT INTO printout (message) VALUES ('step 1');
END if;
END; $$
SQL to create the sequence, table and timestamp:
-- DROP SEQUENCE public.printout_id_seq;
CREATE SEQUENCE public.printout_id_seq
INCREMENT BY 1
MINVALUE 1
MAXVALUE 9223372036854775807;
-- DROP TABLE public.printout;
CREATE TABLE public.printout (
id INTEGER DEFAULT NEXTVAL('printout_id_seq') NOT NULL,
message varchar NOT NULL
);
ALTER TABLE printout ADD COLUMN created_at TIMESTAMP;
ALTER TABLE printout ALTER COLUMN created_at SET DEFAULT now();
Then refresh the PrintOut table to see debug messages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With