Re: client side syntax error localisation for psql (v1)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: client side syntax error localisation for psql (v1)
Дата
Msg-id 21264.1079028336@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: client side syntax error localisation for psql (v1)  (Fabien COELHO <coelho@cri.ensmp.fr>)
Ответы Re: client side syntax error localisation for psql (v1)  (Fabien COELHO <coelho@cri.ensmp.fr>)
Список pgsql-hackers
Fabien COELHO <coelho@cri.ensmp.fr> writes:
>> Another possibility is to keep the cursor as just "^", and bury the
>> line info in the query extract.  For instance:

> Well, I want to preserve space for the query extract, that's where the
> context information is! If I put more information there, I'll have to
> reduce the extract length.

But in the form you are using, you have to reserve that space anyway.
Consider an error marker at the end of the line:
QUERY: select 'text that is long enough to be a problem':QUERY:                                                  ^ on
line1
 

Having to leave space for "on line 1" at the right end is not better
than putting "line 1:" at the left end.

> Moreover the cursor line information content is small, so it seems better
> to put the line information there.

It seems confusing to me.  The cursor is just a marker.  Consider also
the next step up from this scheme: instead of assuming a dumb terminal,
suppose you can use color or underlining or reverse-video or some such.
Then you might want to do just one line of output:
       QUERY: SELECT foo FROM bar WHRE baz;                                  ----

where my underlining represents using the terminal's highlight ability.
With such a scheme, putting LINE n on the same line fits naturally.

> There is also an alignment issue here, as depending on the number of
> figures, the cursor line would have to be fixed accordingly.

Sure, but you have to buy into that anyway if you are going to do "...".
It's not going to add more than about one strlen() call to what you need
to do.

> There is also a localisation issue here, as the translation of both lines
> must match so that the alignment is kept. I thought that if it is the very
> same word, the translation should be the same.

Hmm, that's a good point, although perhaps you could insert a note to
translators to add space as needed to make the two strings the same
length.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: [pgsql-hackers-win32] fsync with sync, and Win32 unlink
Следующее
От: "scott.marlowe"
Дата:
Сообщение: Re: Default Stats Revisited