SQL quote sign syntax fail

17 views
Skip to first unread message

hans....@gmail.com

unread,
Mar 12, 2023, 5:44:50 AM3/12/23
to vim_use
Hi

I have a PostgreSQL dump file with some data in a COPY..stdin block.
When an quote sign occur in "O'Malley" the color changes until next quote sign

Example in file names.sql:

COPY public.names (name) FROM stdin;
Thomas O'Malley
\.

The quote is a legal character in that block and the color should not be changed.

After \. on a single line the color should go back to normal.

Any hint is much appreciated.

best regards
Hans

Lifepillar

unread,
Mar 12, 2023, 7:20:00 AM3/12/23
to vim...@googlegroups.com
On 2023-03-12, hans....@gmail.com <hans....@gmail.com> wrote:
> Hi
>
> I have a PostgreSQL dump file with some data in a COPY..stdin block.
> When an quote sign occur in "O'Malley" the color changes until next quote
> sign
>
> Example in file names.sql:
>
> COPY public.names (name) FROM stdin;
> Thomas O'Malley
> \.
>
> The quote is a legal character in that block and the color should not be
> changed.
>
> After \. on a single line the color should go back to normal.

AFAIK, the syntax is not standard SQL. PostgreSQL's dialect is supported
by my plugin: https://github.com/lifepillar/pgsql.vim.

Unfortunately, currently the plugin has the issue you describe. If you
are interested, please open an issue at
https://github.com/lifepillar/pgsql.vim/issues, and I will try to fix
it.

Hope this helps,
Life.

Hans Schou

unread,
Mar 12, 2023, 3:24:14 PM3/12/23
to vim...@googlegroups.com
On Sun, Mar 12, 2023 at 12:20 PM Lifepillar <lifep...@lifepillar.me> wrote:


AFAIK, the syntax is not standard SQL.
 
PostgreSQL's dialect is supported
by my plugin: https://github.com/lifepillar/pgsql.vim.

Well, I wasn't even using your plugin.

Unfortunately, currently the plugin has the issue you describe. If you
are interested, please open an issue at

It sounds like rather complitaed (I looked in the module)
For now I think I just disable syntax hiughlighting.

Thanks for your feedback.

./hans

Hans Schou

unread,
Mar 13, 2023, 10:00:27 AM3/13/23
to v...@vim.org
Hi

I have a PostgreSQL dump file with some data in a COPY..stdin block.
When an quote sign occur in "O'Malley" the color changes until next quote sign

Example in file names.sql:

COPY public.names (name) FROM stdin;
Thomas O'Malley
\.

The quote is a legal character in that block and the color should not be changed.

After \. on a single line the color should go back to normal.

Christian Brabandt

unread,
Mar 13, 2023, 10:14:29 AM3/13/23
to vim...@googlegroups.com, v...@vim.org
Vim supports several different SQL dialects out-of-the box, but it looks
like PostgreSQL is not available by default (and it assumes that if no
dialect is specified, it will try to use Oracle SQL).

The above looks invalid to my eye for Oracle (but it's been a awhile
since I used Oracle SQL intensively), so I wouldn't expect this to work
properly. So perhaps looks for specific PostgreSQL syntax file.

The already mentioned pgsql from lifepillar seems to be specific for
PostgreSQL (even so it seems to have the same issue as mentioned
elsewhere).

See also :h ft_sql.txt and :h sql.vim

Best,
Christian
--
Frage an Radio Eriwan:
Wir wollen in unserer Schule Schillers Wilhelm Tell aufführen. Dürfen wir das?
Radio Eriwan antwortet:
Im Prinzip ja - aber woher wollt ihr den Apfel nehmen?
Reply all
Reply to author
Forward
0 new messages