On Thu, Jul 10, 2014 at 8:35 PM, Jeevan Chalke <jeevan.cha...@enterprisedb.com> wrote: > Hi, > > Found few more bugs in new code: > > A: > This got bad: > > jeevan@ubuntu:~/pg_master$ ./install/bin/psql postgres > psql (9.5devel) > Type "help" for help. > > > postgres=# \set PROMPT1 '%/[%l]%R%# ' > postgres[1]=# \set PROMPT2 '%/[%l]%R%# ' > postgres[1]=# select > postgres[2]-# * > postgres[3]-# from > postgres[4]-# abc; > ERROR: syntax error at or near "fromabc" > LINE 1: select*fromabc; > > ^ > postgres[1]=# > postgres[1]=# > postgres[1]=# \e > ERROR: syntax error at or near "fromabc" > LINE 1: select*fromabc; > ^ > postgres[1]=# select*fromabc; > ERROR: syntax error at or near "fromabc" > LINE 1: select*fromabc; > ^ > postgres[1]=# > > > See query text in LINE 1:. This is because, you have removed addition of > newline character. Related added_nl_pos. Need more investigation here. > However I don't think these changes are relevant to what you wanted in this > feature. > Will you please explain the idea behind these changes ? > > Moreover, if you don't want to add newline character, then I guess entire > logic related to added_nl_pos is NO more required. You may remove this > variable and its logic altogether, not sure though. Also make sure you > update the relevant comments while doing so. Here you have removed the code > which is adding the newline but the comment there still reads: > /* insert newlines into query buffer between source lines */ > > Need more thoughts on this. > > > B: > > postgres=# \set PROMPT1 '%/[%l]%R%# ' > postgres[1]=# \set PROMPT2 '%/[%l]%R%# ' > postgres[1]=# \e > postgres[-2147483645]-# limit 1; > relname > -------------- > pg_statistic > (1 row) > > > postgres[1]=# > postgres[1]=# select > relname > from > pg_class > limit 1; > > Logic related to wrapping around the cur_line counter is wrong. Actually > issue is with newline variable. If number of lines in \e editor goes beyond > INT_MAX (NOT sure about the practical use), then newline will be -ve which > then enforces cur_line to be negative. To mimic this I have initialized > newline = INT_MAX - 1. >
Thank you for reviewing the patch with variable cases. I have revised the patch, and attached latest patch. > A: > Will you please explain the idea behind these changes ? I thought wrong about adding new to tail of query_buf. The latest patch does not change related to them. > B: I added the condition of cur_line < 0. Regards, ------- Sawada Masahiko
psql-line-number_v4.patch
Description: Binary data
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers