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
aae70b2d
Commit
aae70b2d
authored
Apr 16, 2000
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more psql bug squashing:
\copy without arguments failed commands with too many arguments were too silent
parent
82849df6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
28 deletions
+36
-28
doc/src/sgml/ref/psql-ref.sgml
doc/src/sgml/ref/psql-ref.sgml
+3
-7
src/bin/psql/command.c
src/bin/psql/command.c
+7
-3
src/bin/psql/copy.c
src/bin/psql/copy.c
+11
-3
src/bin/psql/describe.c
src/bin/psql/describe.c
+15
-15
No files found.
doc/src/sgml/ref/psql-ref.sgml
View file @
aae70b2d
<!--
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.3
0 2000/03/27 17:14:43 thomas
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.3
1 2000/04/16 15:46:39 petere
Exp $
Postgres documentation
Postgres documentation
-->
-->
...
@@ -443,16 +443,12 @@ testdb=>
...
@@ -443,16 +443,12 @@ testdb=>
<varlistentry>
<varlistentry>
<term><literal>\do [ <replaceable class="parameter">
pattern
</replaceable> ]</literal></term>
<term><literal>\do [ <replaceable class="parameter">
name
</replaceable> ]</literal></term>
<listitem>
<listitem>
<para>
<para>
Lists available operators with their operand and return types.
Lists available operators with their operand and return types.
If <replaceable class="parameter">
pattern
</replaceable>
If <replaceable class="parameter">
name
</replaceable>
is specified, only operators with that name will be shown.
is specified, only operators with that name will be shown.
(Since this is a regular expression, be sure to quote all special
characters in you operator name with backslashes. To prevent
interpretation of the backslash as a new command, you might also
wish to quote the argument.)
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
...
src/bin/psql/command.c
View file @
aae70b2d
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*
*
* Copyright 2000 by PostgreSQL Global Development Group
* Copyright 2000 by PostgreSQL Global Development Group
*
*
* $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.
29 2000/04/14 23:43:44
petere Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.
30 2000/04/16 15:46:40
petere Exp $
*/
*/
#include "postgres.h"
#include "postgres.h"
#include "command.h"
#include "command.h"
...
@@ -137,8 +137,10 @@ HandleSlashCmds(const char *line,
...
@@ -137,8 +137,10 @@ HandleSlashCmds(const char *line,
status
=
exec_command
(
new_cmd
,
my_line
+
1
,
&
continue_parse
,
query_buf
);
status
=
exec_command
(
new_cmd
,
my_line
+
1
,
&
continue_parse
,
query_buf
);
#if 0 /* turned out to be too annoying */
if (status != CMD_UNKNOWN && isalpha(new_cmd[0]))
if (status != CMD_UNKNOWN && isalpha(new_cmd[0]))
psql_error("Warning: this syntax is deprecated\n");
psql_error("Warning: this syntax is deprecated\n");
#endif
}
}
if
(
status
==
CMD_UNKNOWN
)
if
(
status
==
CMD_UNKNOWN
)
...
@@ -179,7 +181,8 @@ exec_command(const char *cmd,
...
@@ -179,7 +181,8 @@ exec_command(const char *cmd,
bool
quiet
=
QUIET
();
bool
quiet
=
QUIET
();
backslashResult
status
=
CMD_SKIP_LINE
;
backslashResult
status
=
CMD_SKIP_LINE
;
char
*
string
,
char
*
string
,
*
string_cpy
;
*
string_cpy
,
*
val
;
/*
/*
* The 'string' variable will be overwritten to point to the next
* The 'string' variable will be overwritten to point to the next
...
@@ -777,7 +780,8 @@ exec_command(const char *cmd,
...
@@ -777,7 +780,8 @@ exec_command(const char *cmd,
status
=
CMD_ERROR
;
status
=
CMD_ERROR
;
/* eat the rest of the options string */
/* eat the rest of the options string */
while
(
scan_option
(
&
string
,
OT_NORMAL
,
NULL
));
while
((
val
=
scan_option
(
&
string
,
OT_NORMAL
,
NULL
)))
psql_error
(
"
\\
%s: extra argument '%s' ignored
\n
"
,
cmd
,
val
);
if
(
options_string
&&
continue_parse
)
if
(
options_string
&&
continue_parse
)
*
continue_parse
=
options_string
+
(
string
-
string_cpy
);
*
continue_parse
=
options_string
+
(
string
-
string_cpy
);
...
...
src/bin/psql/copy.c
View file @
aae70b2d
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*
*
* Copyright 2000 by PostgreSQL Global Development Group
* Copyright 2000 by PostgreSQL Global Development Group
*
*
* $Header: /cvsroot/pgsql/src/bin/psql/copy.c,v 1.1
4 2000/04/14 23:43:44
petere Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/copy.c,v 1.1
5 2000/04/16 15:46:40
petere Exp $
*/
*/
#include "postgres.h"
#include "postgres.h"
#include "copy.h"
#include "copy.h"
...
@@ -34,7 +34,7 @@ bool copy_in_state;
...
@@ -34,7 +34,7 @@ bool copy_in_state;
* parse_slash_copy
* parse_slash_copy
* -- parses \copy command line
* -- parses \copy command line
*
*
* Accepted syntax: \copy [binary] table|"table" [with oids] from|to filename|'filename'
using delimiters [
'<char>'] [ with null as 'string' ]
* Accepted syntax: \copy [binary] table|"table" [with oids] from|to filename|'filename'
[ using delimiters
'<char>'] [ with null as 'string' ]
* (binary is not here yet)
* (binary is not here yet)
*
*
* returns a malloc'ed structure with the options, or NULL on parsing error
* returns a malloc'ed structure with the options, or NULL on parsing error
...
@@ -74,7 +74,13 @@ parse_slash_copy(const char *args)
...
@@ -74,7 +74,13 @@ parse_slash_copy(const char *args)
bool
error
=
false
;
bool
error
=
false
;
char
quote
;
char
quote
;
line
=
xstrdup
(
args
);
if
(
args
)
line
=
xstrdup
(
args
);
else
{
psql_error
(
"
\\
copy: arguments required
\n
"
);
return
NULL
;
}
if
(
!
(
result
=
calloc
(
1
,
sizeof
(
struct
copy_options
))))
if
(
!
(
result
=
calloc
(
1
,
sizeof
(
struct
copy_options
))))
{
{
...
@@ -191,6 +197,8 @@ parse_slash_copy(const char *args)
...
@@ -191,6 +197,8 @@ parse_slash_copy(const char *args)
}
}
}
}
}
}
else
error
=
true
;
}
}
}
}
}
}
...
...
src/bin/psql/describe.c
View file @
aae70b2d
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*
*
* Copyright 2000 by PostgreSQL Global Development Group
* Copyright 2000 by PostgreSQL Global Development Group
*
*
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.
19 2000/04/12 17:16:22 momjian
Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.
20 2000/04/16 15:46:40 petere
Exp $
*/
*/
#include "postgres.h"
#include "postgres.h"
#include "describe.h"
#include "describe.h"
...
@@ -52,7 +52,7 @@ describeAggregates(const char *name)
...
@@ -52,7 +52,7 @@ describeAggregates(const char *name)
if
(
name
)
if
(
name
)
{
{
strcat
(
buf
,
" AND a.aggname ~
*
'^"
);
strcat
(
buf
,
" AND a.aggname ~ '^"
);
strncat
(
buf
,
name
,
REGEXP_CUTOFF
);
strncat
(
buf
,
name
,
REGEXP_CUTOFF
);
strcat
(
buf
,
"'
\n
"
);
strcat
(
buf
,
"'
\n
"
);
}
}
...
@@ -67,7 +67,7 @@ describeAggregates(const char *name)
...
@@ -67,7 +67,7 @@ describeAggregates(const char *name)
if
(
name
)
if
(
name
)
{
{
strcat
(
buf
,
" AND a.aggname ~
*
'^"
);
strcat
(
buf
,
" AND a.aggname ~ '^"
);
strncat
(
buf
,
name
,
REGEXP_CUTOFF
);
strncat
(
buf
,
name
,
REGEXP_CUTOFF
);
strcat
(
buf
,
"'
\n
"
);
strcat
(
buf
,
"'
\n
"
);
}
}
...
@@ -121,7 +121,7 @@ describeFunctions(const char *name, bool verbose)
...
@@ -121,7 +121,7 @@ describeFunctions(const char *name, bool verbose)
if
(
name
)
if
(
name
)
{
{
strcat
(
buf
,
" AND p.proname ~
*
'^"
);
strcat
(
buf
,
" AND p.proname ~ '^"
);
strncat
(
buf
,
name
,
REGEXP_CUTOFF
);
strncat
(
buf
,
name
,
REGEXP_CUTOFF
);
strcat
(
buf
,
"'
\n
"
);
strcat
(
buf
,
"'
\n
"
);
}
}
...
@@ -166,7 +166,7 @@ describeTypes(const char *name, bool verbose)
...
@@ -166,7 +166,7 @@ describeTypes(const char *name, bool verbose)
if
(
name
)
if
(
name
)
{
{
strcat
(
buf
,
" AND t.typname ~
*
'^"
);
strcat
(
buf
,
" AND t.typname ~ '^"
);
strncat
(
buf
,
name
,
REGEXP_CUTOFF
);
strncat
(
buf
,
name
,
REGEXP_CUTOFF
);
strcat
(
buf
,
"' "
);
strcat
(
buf
,
"' "
);
}
}
...
@@ -212,7 +212,7 @@ describeOperators(const char *name)
...
@@ -212,7 +212,7 @@ describeOperators(const char *name)
" o.oprright = t2.oid
\n
"
);
" o.oprright = t2.oid
\n
"
);
if
(
name
)
if
(
name
)
{
{
strcat
(
buf
,
" AND o.oprname
~ '^
"
);
strcat
(
buf
,
" AND o.oprname
= '
"
);
strncat
(
buf
,
name
,
REGEXP_CUTOFF
);
strncat
(
buf
,
name
,
REGEXP_CUTOFF
);
strcat
(
buf
,
"'
\n
"
);
strcat
(
buf
,
"'
\n
"
);
}
}
...
@@ -230,7 +230,7 @@ describeOperators(const char *name)
...
@@ -230,7 +230,7 @@ describeOperators(const char *name)
" o.oprright = t1.oid
\n
"
);
" o.oprright = t1.oid
\n
"
);
if
(
name
)
if
(
name
)
{
{
strcat
(
buf
,
"AND o.oprname
~ '^
"
);
strcat
(
buf
,
"AND o.oprname
= '
"
);
strncat
(
buf
,
name
,
REGEXP_CUTOFF
);
strncat
(
buf
,
name
,
REGEXP_CUTOFF
);
strcat
(
buf
,
"'
\n
"
);
strcat
(
buf
,
"'
\n
"
);
}
}
...
@@ -248,7 +248,7 @@ describeOperators(const char *name)
...
@@ -248,7 +248,7 @@ describeOperators(const char *name)
" o.oprleft = t1.oid
\n
"
);
" o.oprleft = t1.oid
\n
"
);
if
(
name
)
if
(
name
)
{
{
strcat
(
buf
,
"AND o.oprname
~ '^
"
);
strcat
(
buf
,
"AND o.oprname
= '
"
);
strncat
(
buf
,
name
,
REGEXP_CUTOFF
);
strncat
(
buf
,
name
,
REGEXP_CUTOFF
);
strcat
(
buf
,
"'
\n
"
);
strcat
(
buf
,
"'
\n
"
);
}
}
...
@@ -388,7 +388,7 @@ objectDescription(const char *object)
...
@@ -388,7 +388,7 @@ objectDescription(const char *object)
"WHERE a.oid = d.objoid
\n
"
);
"WHERE a.oid = d.objoid
\n
"
);
if
(
object
)
if
(
object
)
{
{
strcat
(
descbuf
,
" AND a.aggname ~
*
'^"
);
strcat
(
descbuf
,
" AND a.aggname ~ '^"
);
strncat
(
descbuf
,
object
,
REGEXP_CUTOFF
);
strncat
(
descbuf
,
object
,
REGEXP_CUTOFF
);
strcat
(
descbuf
,
"'
\n
"
);
strcat
(
descbuf
,
"'
\n
"
);
}
}
...
@@ -400,7 +400,7 @@ objectDescription(const char *object)
...
@@ -400,7 +400,7 @@ objectDescription(const char *object)
"WHERE p.oid = d.objoid AND (p.pronargs = 0 or oidvectortypes(p.proargtypes) != '')
\n
"
);
"WHERE p.oid = d.objoid AND (p.pronargs = 0 or oidvectortypes(p.proargtypes) != '')
\n
"
);
if
(
object
)
if
(
object
)
{
{
strcat
(
descbuf
,
" AND p.proname ~
*
'^"
);
strcat
(
descbuf
,
" AND p.proname ~ '^"
);
strncat
(
descbuf
,
object
,
REGEXP_CUTOFF
);
strncat
(
descbuf
,
object
,
REGEXP_CUTOFF
);
strcat
(
descbuf
,
"'
\n
"
);
strcat
(
descbuf
,
"'
\n
"
);
}
}
...
@@ -413,7 +413,7 @@ objectDescription(const char *object)
...
@@ -413,7 +413,7 @@ objectDescription(const char *object)
"WHERE RegprocToOid(o.oprcode) = d.objoid
\n
"
);
"WHERE RegprocToOid(o.oprcode) = d.objoid
\n
"
);
if
(
object
)
if
(
object
)
{
{
strcat
(
descbuf
,
" AND o.oprname
~ '^
"
);
strcat
(
descbuf
,
" AND o.oprname
= '
"
);
strncat
(
descbuf
,
object
,
REGEXP_CUTOFF
);
strncat
(
descbuf
,
object
,
REGEXP_CUTOFF
);
strcat
(
descbuf
,
"'
\n
"
);
strcat
(
descbuf
,
"'
\n
"
);
}
}
...
@@ -425,7 +425,7 @@ objectDescription(const char *object)
...
@@ -425,7 +425,7 @@ objectDescription(const char *object)
"WHERE t.oid = d.objoid
\n
"
);
"WHERE t.oid = d.objoid
\n
"
);
if
(
object
)
if
(
object
)
{
{
strcat
(
descbuf
,
" AND t.typname ~
*
'^"
);
strcat
(
descbuf
,
" AND t.typname ~ '^"
);
strncat
(
descbuf
,
object
,
REGEXP_CUTOFF
);
strncat
(
descbuf
,
object
,
REGEXP_CUTOFF
);
strcat
(
descbuf
,
"'
\n
"
);
strcat
(
descbuf
,
"'
\n
"
);
}
}
...
@@ -437,7 +437,7 @@ objectDescription(const char *object)
...
@@ -437,7 +437,7 @@ objectDescription(const char *object)
"WHERE c.oid = d.objoid
\n
"
);
"WHERE c.oid = d.objoid
\n
"
);
if
(
object
)
if
(
object
)
{
{
strcat
(
descbuf
,
" AND c.relname ~
*
'^"
);
strcat
(
descbuf
,
" AND c.relname ~ '^"
);
strncat
(
descbuf
,
object
,
REGEXP_CUTOFF
);
strncat
(
descbuf
,
object
,
REGEXP_CUTOFF
);
strcat
(
descbuf
,
"'
\n
"
);
strcat
(
descbuf
,
"'
\n
"
);
}
}
...
@@ -449,7 +449,7 @@ objectDescription(const char *object)
...
@@ -449,7 +449,7 @@ objectDescription(const char *object)
"WHERE r.oid = d.objoid AND r.rulename !~ '^_RET'
\n
"
);
"WHERE r.oid = d.objoid AND r.rulename !~ '^_RET'
\n
"
);
if
(
object
)
if
(
object
)
{
{
strcat
(
descbuf
,
" AND r.rulename ~
*
'^"
);
strcat
(
descbuf
,
" AND r.rulename ~ '^"
);
strncat
(
descbuf
,
object
,
REGEXP_CUTOFF
);
strncat
(
descbuf
,
object
,
REGEXP_CUTOFF
);
strcat
(
descbuf
,
"'
\n
"
);
strcat
(
descbuf
,
"'
\n
"
);
}
}
...
@@ -461,7 +461,7 @@ objectDescription(const char *object)
...
@@ -461,7 +461,7 @@ objectDescription(const char *object)
"WHERE t.oid = d.objoid
\n
"
);
"WHERE t.oid = d.objoid
\n
"
);
if
(
object
)
if
(
object
)
{
{
strcat
(
descbuf
,
" AND t.tgname ~
*
'^"
);
strcat
(
descbuf
,
" AND t.tgname ~ '^"
);
strncat
(
descbuf
,
object
,
REGEXP_CUTOFF
);
strncat
(
descbuf
,
object
,
REGEXP_CUTOFF
);
strcat
(
descbuf
,
"'
\n
"
);
strcat
(
descbuf
,
"'
\n
"
);
}
}
...
...
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