I need to keep the comments I add inside a SQL query when I create views from complex queries, in order to come back to views definition more easily. Within pgAdminIII, when I create a view and then consult the view definition, the comments are deleted and indentation completely revised... Is there a way to change this behaviour?
View creation:
CREATE OR REPLACE VIEW public.v_test AS
-- Count number of null lines within table 'test'
(SELECT * FROM public.test WHERE client IS NULL);
View definition after creation, as displayed in pgAdminIII:
-- View: v_test
-- DROP VIEW v_test;
CREATE OR REPLACE VIEW v_test AS
SELECT test.gid,
test.client
FROM test
WHERE test.client IS NULL;
ALTER TABLE v_test
OWNER TO postgres;
Thanks for help!
No, Postgres saves views as parse trees, so it does not remember whitespace or comments.
However, if you really need it, functions
can remember comments.