Created
July 21, 2016 07:30
-
-
Save dialogbox/038b9e3bdf303d030f7dd4a9cb1b03e7 to your computer and use it in GitHub Desktop.
Vim ex command to add type specifier to all string constant in PostgreSQL.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:%s/\('.\{-}'\)\(\s*\)\(::\)\@!/\1::text\2/g |
:%s/\('\(''\|[^']\)*'\)\(\s*\)/\1::text\3/g
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It converts
select 'aaa';
toselect 'aaa'::text;
.