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
8cec4cf9
Commit
8cec4cf9
authored
Oct 14, 1998
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New QUERY_LIMIT set command.
parent
39f2ec55
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
161 additions
and
18 deletions
+161
-18
doc/src/sgml/ref/set.sgml
doc/src/sgml/ref/set.sgml
+38
-0
src/backend/commands/variable.c
src/backend/commands/variable.c
+96
-7
src/backend/executor/execMain.c
src/backend/executor/execMain.c
+7
-3
src/bin/psql/psqlHelp.h
src/bin/psql/psqlHelp.h
+8
-6
src/include/executor/executor.h
src/include/executor/executor.h
+5
-1
src/man/set.l
src/man/set.l
+7
-1
No files found.
doc/src/sgml/ref/set.sgml
View file @
8cec4cf9
...
@@ -415,6 +415,44 @@ Equivalent to specifying <command>SET R_PLANS=Off</command>.
...
@@ -415,6 +415,44 @@ Equivalent to specifying <command>SET R_PLANS=Off</command>.
The frontend may be initialized by setting the PGRPLANS
The frontend may be initialized by setting the PGRPLANS
environment variable.
environment variable.
<varlistentry>
<term>
QUERY_LIMIT
</term>
<listitem>
<para>
Sets the number of rows returned by a query.
<variablelist>
<varlistentry>
<term>
Value
</term>
<listitem>
<para>
Maximum number of rows to return for a query. The default is unlimited.
<varlistentry>
<term>
<replaceable class="parameter">#</replaceable>
</term>
<listitem>
<para>
Sets the maximum number of rows returned by a
query to <replaceable class="parameter">#</replaceable>.
<varlistentry>
<term>
DEFAULT
</term>
<listitem>
<para>
Sets the number of rows returned by a query to unlimited.
</varlistentry>
<para>
By default, there is no limit to the number of rows
returned by a query.
</variablelist>
</VARLISTENTRY>
</VARLISTENTRY>
</VARIABLELIST>
</VARIABLELIST>
</REFSECT2>
</REFSECT2>
...
...
src/backend/commands/variable.c
View file @
8cec4cf9
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* Routines for handling of 'SET var TO',
* Routines for handling of 'SET var TO',
* 'SHOW var' and 'RESET var' statements.
* 'SHOW var' and 'RESET var' statements.
*
*
* $Id: variable.c,v 1.1
5 1998/10/08 23:50:28 tgl
Exp $
* $Id: variable.c,v 1.1
6 1998/10/14 05:09:58 momjian
Exp $
*
*
*/
*/
...
@@ -18,6 +18,10 @@
...
@@ -18,6 +18,10 @@
#ifdef MULTIBYTE
#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
#include "mb/pg_wchar.h"
#endif
#endif
#ifdef QUERY_LIMIT
#include "executor/executor.h"
#include "executor/execdefs.h"
#endif
static
bool
show_date
(
void
);
static
bool
show_date
(
void
);
static
bool
reset_date
(
void
);
static
bool
reset_date
(
void
);
...
@@ -40,6 +44,11 @@ static bool parse_geqo(const char *);
...
@@ -40,6 +44,11 @@ static bool parse_geqo(const char *);
static
bool
show_ksqo
(
void
);
static
bool
show_ksqo
(
void
);
static
bool
reset_ksqo
(
void
);
static
bool
reset_ksqo
(
void
);
static
bool
parse_ksqo
(
const
char
*
);
static
bool
parse_ksqo
(
const
char
*
);
#ifdef QUERY_LIMIT
static
bool
show_query_limit
(
void
);
static
bool
reset_query_limit
(
void
);
static
bool
parse_query_limit
(
const
char
*
);
#endif
extern
Cost
_cpu_page_wight_
;
extern
Cost
_cpu_page_wight_
;
extern
Cost
_cpu_index_page_wight_
;
extern
Cost
_cpu_index_page_wight_
;
...
@@ -48,7 +57,11 @@ extern int32 _use_geqo_rels_;
...
@@ -48,7 +57,11 @@ extern int32 _use_geqo_rels_;
extern
bool
_use_right_sided_plans_
;
extern
bool
_use_right_sided_plans_
;
extern
bool
_use_keyset_query_optimizer
;
extern
bool
_use_keyset_query_optimizer
;
/*-----------------------------------------------------------------------*/
/*
*
* Get_Token
*
*/
static
const
char
*
static
const
char
*
get_token
(
char
**
tok
,
char
**
val
,
const
char
*
str
)
get_token
(
char
**
tok
,
char
**
val
,
const
char
*
str
)
{
{
...
@@ -149,7 +162,11 @@ get_token(char **tok, char **val, const char *str)
...
@@ -149,7 +162,11 @@ get_token(char **tok, char **val, const char *str)
return
str
;
return
str
;
}
}
/*-----------------------------------------------------------------------*/
/*
*
* GEQO
*
*/
static
bool
static
bool
parse_geqo
(
const
char
*
value
)
parse_geqo
(
const
char
*
value
)
{
{
...
@@ -221,6 +238,11 @@ reset_geqo(void)
...
@@ -221,6 +238,11 @@ reset_geqo(void)
return
TRUE
;
return
TRUE
;
}
}
/*
*
* R_PLANS
*
*/
static
bool
static
bool
parse_r_plans
(
const
char
*
value
)
parse_r_plans
(
const
char
*
value
)
{
{
...
@@ -240,7 +262,6 @@ parse_r_plans(const char *value)
...
@@ -240,7 +262,6 @@ parse_r_plans(const char *value)
return
TRUE
;
return
TRUE
;
}
}
/*-----------------------------------------------------------------------*/
static
bool
static
bool
show_r_plans
()
show_r_plans
()
{
{
...
@@ -264,7 +285,11 @@ reset_r_plans()
...
@@ -264,7 +285,11 @@ reset_r_plans()
return
TRUE
;
return
TRUE
;
}
}
/*-----------------------------------------------------------------------*/
/*
*
* COST_HEAP
*
*/
static
bool
static
bool
parse_cost_heap
(
const
char
*
value
)
parse_cost_heap
(
const
char
*
value
)
{
{
...
@@ -297,7 +322,11 @@ reset_cost_heap()
...
@@ -297,7 +322,11 @@ reset_cost_heap()
return
TRUE
;
return
TRUE
;
}
}
/*-----------------------------------------------------------------------*/
/*
*
* COST_INDEX
*
*/
static
bool
static
bool
parse_cost_index
(
const
char
*
value
)
parse_cost_index
(
const
char
*
value
)
{
{
...
@@ -330,7 +359,11 @@ reset_cost_index()
...
@@ -330,7 +359,11 @@ reset_cost_index()
return
TRUE
;
return
TRUE
;
}
}
/*-----------------------------------------------------------------------*/
/*
*
* DATE_STYLE
*
*/
static
bool
static
bool
parse_date
(
const
char
*
value
)
parse_date
(
const
char
*
value
)
{
{
...
@@ -448,6 +481,11 @@ static char *defaultTZ = NULL;
...
@@ -448,6 +481,11 @@ static char *defaultTZ = NULL;
static
char
TZvalue
[
64
];
static
char
TZvalue
[
64
];
static
char
tzbuf
[
64
];
static
char
tzbuf
[
64
];
/*
*
* TIMEZONE
*
*/
/* parse_timezone()
/* parse_timezone()
* Handle SET TIME ZONE...
* Handle SET TIME ZONE...
* Try to save existing TZ environment variable for later use in RESET TIME ZONE.
* Try to save existing TZ environment variable for later use in RESET TIME ZONE.
...
@@ -545,7 +583,53 @@ reset_timezone()
...
@@ -545,7 +583,53 @@ reset_timezone()
return
TRUE
;
return
TRUE
;
}
/* reset_timezone() */
}
/* reset_timezone() */
/*
*
* Query_limit
*
*/
#ifdef QUERY_LIMIT
static
bool
parse_query_limit
(
const
char
*
value
)
{
int32
limit
;
if
(
value
==
NULL
)
{
reset_query_limit
();
return
(
TRUE
);
}
limit
=
pg_atoi
(
value
,
sizeof
(
int32
),
'\0'
);
if
(
limit
<=
-
1
)
{
elog
(
ERROR
,
"Bad value for # of query limit (%s)"
,
value
);
}
ExecutorLimit
(
limit
);
return
(
TRUE
);
}
static
bool
show_query_limit
(
void
)
{
int
limit
;
limit
=
ExecutorGetLimit
();
if
(
limit
==
ALL_TUPLES
)
{
elog
(
NOTICE
,
"No query limit is set"
);
}
else
{
elog
(
NOTICE
,
"query limit is %d"
,
limit
);
}
return
(
TRUE
);
}
static
bool
reset_query_limit
(
void
)
{
ExecutorLimit
(
ALL_TUPLES
);
return
(
TRUE
);
}
#endif
/*-----------------------------------------------------------------------*/
/*-----------------------------------------------------------------------*/
struct
VariableParsers
struct
VariableParsers
{
{
const
char
*
name
;
const
char
*
name
;
...
@@ -584,6 +668,11 @@ struct VariableParsers
...
@@ -584,6 +668,11 @@ struct VariableParsers
{
{
"ksqo"
,
parse_ksqo
,
show_ksqo
,
reset_ksqo
"ksqo"
,
parse_ksqo
,
show_ksqo
,
reset_ksqo
},
},
#ifdef QUERY_LIMIT
{
"query_limit"
,
parse_query_limit
,
show_query_limit
,
reset_query_limit
},
#endif
{
{
NULL
,
NULL
,
NULL
,
NULL
NULL
,
NULL
,
NULL
,
NULL
}
}
...
...
src/backend/executor/execMain.c
View file @
8cec4cf9
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.5
7 1998/10/01 02:03:58 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.5
8 1998/10/14 05:10:00 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -83,14 +83,18 @@ static int queryLimit = ALL_TUPLES;
...
@@ -83,14 +83,18 @@ static int queryLimit = ALL_TUPLES;
#undef ALL_TUPLES
#undef ALL_TUPLES
#define ALL_TUPLES queryLimit
#define ALL_TUPLES queryLimit
int
ExecutorLimit
(
int
limit
);
int
int
ExecutorLimit
(
int
limit
)
ExecutorLimit
(
int
limit
)
{
{
return
queryLimit
=
limit
;
return
queryLimit
=
limit
;
}
}
int
ExecutorGetLimit
()
{
return
queryLimit
;
}
#endif
#endif
/* ----------------------------------------------------------------
/* ----------------------------------------------------------------
...
...
src/bin/psql/psqlHelp.h
View file @
8cec4cf9
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: psqlHelp.h,v 1.5
3 1998/10/08 01:10:28 tgl
Exp $
* $Id: psqlHelp.h,v 1.5
4 1998/10/14 05:10:02 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -296,10 +296,10 @@ static struct _helpStruct QL_HELP[] = {
...
@@ -296,10 +296,10 @@ static struct _helpStruct QL_HELP[] = {
"set run-time environment back to default"
,
"set run-time environment back to default"
,
#ifdef MULTIBYTE
#ifdef MULTIBYTE
"\
"\
\t
RESET DateStyle|GEQO|R_PLANS|CLIENT_ENCODING"
},
\t
RESET DateStyle|GEQO|R_PLANS|
QUERY_LIMIT|
CLIENT_ENCODING"
},
#else
#else
"\
"\
\t
RESET DateStyle|GEQO|R_PLANS"
},
\t
RESET DateStyle|GEQO|R_PLANS
|QUERY_LIMIT
"
},
#endif
#endif
{
"revoke"
,
{
"revoke"
,
"revoke access control from a user or group"
,
"revoke access control from a user or group"
,
...
@@ -329,21 +329,23 @@ static struct _helpStruct QL_HELP[] = {
...
@@ -329,21 +329,23 @@ static struct _helpStruct QL_HELP[] = {
\t
SET DateStyle TO 'ISO'|'SQL'|'Postgres'|'European'|'US'|'NonEuropean'
\n
\
\t
SET DateStyle TO 'ISO'|'SQL'|'Postgres'|'European'|'US'|'NonEuropean'
\n
\
set GEQO TO 'ON[=#]'|'OFF'
\n
\
set GEQO TO 'ON[=#]'|'OFF'
\n
\
set R_PLANS TO 'ON'|'OFF'
\n
\
set R_PLANS TO 'ON'|'OFF'
\n
\
set QUERY_LIMIT TO #
\n
\
set CLIENT_ENCODING TO 'EUC_JP'|'SJIS'|'EUC_CN'|'EUC_KR'|'EUC_TW'|'MULE_INTERNAL'|'LATIN1'|'LATIN2'|'LATIN3'|'LATIN4'|'LATIN5'"
},
set CLIENT_ENCODING TO 'EUC_JP'|'SJIS'|'EUC_CN'|'EUC_KR'|'EUC_TW'|'MULE_INTERNAL'|'LATIN1'|'LATIN2'|'LATIN3'|'LATIN4'|'LATIN5'"
},
#else
#else
"\
"\
\t
SET DateStyle TO 'ISO'|'SQL'|'Postgres'|'European'|'US'|'NonEuropean'
\n
\
\t
SET DateStyle TO 'ISO'|'SQL'|'Postgres'|'European'|'US'|'NonEuropean'
\n
\
set GEQO TO 'ON[=#]'|'OFF'
\n
\
set GEQO TO 'ON[=#]'|'OFF'
\n
\
set R_PLANS TO 'ON'| 'OFF'"
}
,
set R_PLANS TO 'ON'| 'OFF'
\n
\
set QUERY_LIMIT TO #"
}
,
#endif
#endif
{
"show"
,
{
"show"
,
"show current run-time environment"
,
"show current run-time environment"
,
#ifdef MULTIBYTE
#ifdef MULTIBYTE
"\
"\
\t
SHOW DateStyle|GEQO|R_PLANS|CLIENT_ENCODING"
},
\t
SHOW DateStyle|GEQO|R_PLANS|
QUERY_LIMIT|
CLIENT_ENCODING"
},
#else
#else
"\
"\
\t
SHOW DateStyle|GEQO|R_PLANS"
}
,
\t
SHOW DateStyle|GEQO|R_PLANS
|QUERY_LIMIT
"
}
,
#endif
#endif
{
"unlisten"
,
{
"unlisten"
,
"stop listening for notification on a condition name"
,
"stop listening for notification on a condition name"
,
...
...
src/include/executor/executor.h
View file @
8cec4cf9
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: executor.h,v 1.2
6 1998/10/08 18:30:29
momjian Exp $
* $Id: executor.h,v 1.2
7 1998/10/14 05:10:05
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -86,6 +86,10 @@ extern TupleDesc ExecutorStart(QueryDesc *queryDesc, EState *estate);
...
@@ -86,6 +86,10 @@ extern TupleDesc ExecutorStart(QueryDesc *queryDesc, EState *estate);
extern
TupleTableSlot
*
ExecutorRun
(
QueryDesc
*
queryDesc
,
EState
*
estate
,
int
feature
,
int
count
);
extern
TupleTableSlot
*
ExecutorRun
(
QueryDesc
*
queryDesc
,
EState
*
estate
,
int
feature
,
int
count
);
extern
void
ExecutorEnd
(
QueryDesc
*
queryDesc
,
EState
*
estate
);
extern
void
ExecutorEnd
(
QueryDesc
*
queryDesc
,
EState
*
estate
);
extern
HeapTuple
ExecConstraints
(
char
*
caller
,
Relation
rel
,
HeapTuple
tuple
);
extern
HeapTuple
ExecConstraints
(
char
*
caller
,
Relation
rel
,
HeapTuple
tuple
);
#ifdef QUERY_LIMIT
extern
int
ExecutorLimit
(
int
limit
);
extern
int
ExecutorGetLimit
(
void
);
#endif
/*
/*
* prototypes from functions in execProcnode.c
* prototypes from functions in execProcnode.c
...
...
src/man/set.l
View file @
8cec4cf9
.\" This is -*-nroff-*-
.\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here....
.\" XXX standard disclaimer belongs here....
.\" $Header: /cvsroot/pgsql/src/man/Attic/set.l,v 1.1
0 1998/10/14 02:36:44
momjian Exp $
.\" $Header: /cvsroot/pgsql/src/man/Attic/set.l,v 1.1
1 1998/10/14 05:10:12
momjian Exp $
.TH SET SQL 05/14/97 PostgreSQL PostgreSQL
.TH SET SQL 05/14/97 PostgreSQL PostgreSQL
.SH NAME
.SH NAME
set - set run-time parameters for session
set - set run-time parameters for session
...
@@ -76,6 +76,12 @@ by default. It's not used by GEQO anyway.
...
@@ -76,6 +76,12 @@ by default. It's not used by GEQO anyway.
off - do not use right-hand plan evaluation
off - do not use right-hand plan evaluation
.fi
.fi
.PP
.IR QUERY_LIMIT
restricts the number of rows returned by a query.
The default is unlimited.
.SH EXAMPLES
.SH EXAMPLES
.nf
.nf
--
--
...
...
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