Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
5e3bcac1
Commit
5e3bcac1
authored
Mar 06, 2006
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix psql history handling so 'execute' backslash commands (\g)
remain as part of the multi-line query.
parent
2f01703f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
23 deletions
+24
-23
src/bin/psql/mainloop.c
src/bin/psql/mainloop.c
+24
-23
No files found.
src/bin/psql/mainloop.c
View file @
5e3bcac1
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/mainloop.c,v 1.7
2 2006/03/06 04:45:21
momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/mainloop.c,v 1.7
3 2006/03/06 15:09:04
momjian Exp $
*/
#include "postgres_fe.h"
#include "mainloop.h"
...
...
@@ -236,23 +236,6 @@ MainLoop(FILE *source)
scan_result
=
psql_scan
(
scan_state
,
query_buf
,
&
prompt_tmp
);
prompt_status
=
prompt_tmp
;
/*
* If we append to history a backslash command that is inside
* a multi-line query, then when we recall the history, the
* backslash command will make the query invalid, so we write
* backslash commands immediately rather than keeping them
* as part of the current multi-line query.
*/
if
(
first_query_scan
&&
pset
.
cur_cmd_interactive
)
{
if
(
scan_result
==
PSCAN_BACKSLASH
&&
query_buf
->
len
!=
0
)
pg_write_history
(
line
);
else
pg_append_history
(
line
,
history_buf
);
}
first_query_scan
=
false
;
/*
* Send command if semicolon found, or if end of line and we're in
* single-line mode.
...
...
@@ -309,17 +292,35 @@ MainLoop(FILE *source)
/* flush any paren nesting info after forced send */
psql_scan_reset
(
scan_state
);
}
}
if
(
slashCmdStatus
==
PSQL_CMD_TERMINATE
)
break
;
/*
* If we append to history a backslash command that is inside
* a multi-line query, then when we recall the history, the
* backslash command will make the query invalid, so we write
* backslash commands immediately rather than keeping them
* as part of the current multi-line query. We do the test
* down here so we can check for \g and other 'execute'
* backslash commands, which should be appended.
*/
if
(
first_query_scan
&&
pset
.
cur_cmd_interactive
)
{
/* Sending a command (PSQL_CMD_SEND) zeros the length */
if
(
scan_result
==
PSCAN_BACKSLASH
&&
query_buf
->
len
!=
0
)
pg_write_history
(
line
);
else
pg_append_history
(
line
,
history_buf
);
}
/* fall out of loop if lexer reached EOL */
if
(
scan_result
==
PSCAN_INCOMPLETE
||
first_query_scan
=
false
;
/* fall out of loop on \q or if lexer reached EOL */
if
(
slashCmdStatus
==
PSQL_CMD_TERMINATE
||
scan_result
==
PSCAN_INCOMPLETE
||
scan_result
==
PSCAN_EOL
)
break
;
}
if
(
pset
.
cur_cmd_interactive
&&
prompt_status
!=
PROMPT_CONTINUE
)
{
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment