Closed rodo closed 8 years ago
it's not just columns. Its damn near every object. Frankly most of the code here should be updated to use quote_literal()
when selecting objects from the database, and the resulting names written out as-is.s
Thanks for the heads up on quote_literal()
I've updated my PR, only on the colums for the moment, I'll look forward to do the replace on other parts. By now I've just fixed this part because I'm working on another PR about triggers, I need to check triggers so I'm working on a triggers_are()
function.
Sorry, should be quote_ident()
, not quote_literal()
. My fault. Was thinking of doing an audit of all objects after merging #6.
quote_ident()
doesn't work if you have for example a serial
table_public.document.pg .. 1/? psql:table_public.document.pg:97: ERROR: column "nextval('document_id_seq'::regclass)" does not exist
LINE 1: ...LECT col_default_is( 'document', 'id', "nextval('...
The tap.file contains :
SELECT col_default_is( 'document', 'id', "nextval('document_id_seq'::regclass)");
We need to quote_literal
and remove the cast orperator in certain case, don't we ?
May be we can find a more beautiful way but what I did in is functionnal https://github.com/rodo/tap-parser-sourcehandler-pgtap/pull/5/files
Yeah, sorry, you're right, quote_literal()
is the correct approach here.
I cherry-picked this change in 8162bb5, thanks!
With column with default value as text the generated file is bugy, I double the quote to FIX this