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
7016678a
Commit
7016678a
authored
Nov 07, 1997
by
Thomas G. Lockhart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable SET value = DEFAULT by passing null parameter to parsers.
Enable SET TIME ZONE using TZ environment variable.
parent
b2905ea4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
27 deletions
+85
-27
src/backend/tcop/variable.c
src/backend/tcop/variable.c
+85
-27
No files found.
src/backend/tcop/variable.c
View file @
7016678a
...
...
@@ -2,7 +2,7 @@
* Routines for handling of 'SET var TO',
* 'SHOW var' and 'RESET var' statements.
*
* $Id: variable.c,v 1.1
8 1997/10/30 16:52:11
thomas Exp $
* $Id: variable.c,v 1.1
9 1997/11/07 06:43:16
thomas Exp $
*
*/
...
...
@@ -156,13 +156,19 @@ reset_null(const char *value)
}
#endif
static
bool
bool
parse_geqo
(
const
char
*
value
)
{
const
char
*
rest
;
char
*
tok
,
*
val
;
if
(
value
==
NULL
)
{
reset_geqo
();
return
TRUE
;
}
rest
=
get_token
(
&
tok
,
&
val
,
value
);
if
(
tok
==
NULL
)
elog
(
WARN
,
"Value undefined"
);
...
...
@@ -197,7 +203,7 @@ parse_geqo(const char *value)
return
TRUE
;
}
static
bool
bool
show_geqo
()
{
...
...
@@ -208,8 +214,8 @@ show_geqo()
return
TRUE
;
}
static
bool
reset_geqo
()
bool
reset_geqo
(
void
)
{
#ifdef GEQO
...
...
@@ -221,9 +227,14 @@ reset_geqo()
return
TRUE
;
}
static
bool
bool
parse_r_plans
(
const
char
*
value
)
{
if
(
value
==
NULL
)
{
reset_r_plans
();
return
TRUE
;
}
if
(
strcasecmp
(
value
,
"on"
)
==
0
)
_use_right_sided_plans_
=
true
;
...
...
@@ -235,7 +246,7 @@ parse_r_plans(const char *value)
return
TRUE
;
}
static
bool
bool
show_r_plans
()
{
...
...
@@ -246,7 +257,7 @@ show_r_plans()
return
TRUE
;
}
static
bool
bool
reset_r_plans
()
{
...
...
@@ -258,17 +269,24 @@ reset_r_plans()
return
TRUE
;
}
static
bool
bool
parse_cost_heap
(
const
char
*
value
)
{
float32
res
=
float4in
((
char
*
)
value
);
float32
res
;
if
(
value
==
NULL
)
{
reset_cost_heap
();
return
TRUE
;
}
res
=
float4in
((
char
*
)
value
);
_cpu_page_wight_
=
*
res
;
return
TRUE
;
}
static
bool
bool
show_cost_heap
()
{
...
...
@@ -276,24 +294,31 @@ show_cost_heap()
return
TRUE
;
}
static
bool
bool
reset_cost_heap
()
{
_cpu_page_wight_
=
_CPU_PAGE_WEIGHT_
;
return
TRUE
;
}
static
bool
bool
parse_cost_index
(
const
char
*
value
)
{
float32
res
=
float4in
((
char
*
)
value
);
float32
res
;
if
(
value
==
NULL
)
{
reset_cost_index
();
return
TRUE
;
}
res
=
float4in
((
char
*
)
value
);
_cpu_index_page_wight_
=
*
res
;
return
TRUE
;
}
static
bool
bool
show_cost_index
()
{
...
...
@@ -301,20 +326,26 @@ show_cost_index()
return
TRUE
;
}
static
bool
bool
reset_cost_index
()
{
_cpu_index_page_wight_
=
_CPU_INDEX_PAGE_WEIGHT_
;
return
TRUE
;
}
static
bool
bool
parse_date
(
const
char
*
value
)
{
char
*
tok
;
int
dcnt
=
0
,
ecnt
=
0
;
if
(
value
==
NULL
)
{
reset_date
();
return
TRUE
;
}
while
((
value
=
get_token
(
&
tok
,
NULL
,
value
))
!=
0
)
{
/* Ugh. Somebody ought to write a table driven version -- mjl */
...
...
@@ -364,7 +395,7 @@ parse_date(const char *value)
return
TRUE
;
}
static
bool
bool
show_date
()
{
char
buf
[
64
];
...
...
@@ -391,7 +422,7 @@ show_date()
return
TRUE
;
}
static
bool
bool
reset_date
()
{
DateStyle
=
USE_POSTGRES_DATES
;
...
...
@@ -400,13 +431,35 @@ reset_date()
return
TRUE
;
}
static
bool
static
char
*
defaultTZ
=
NULL
;
static
char
TZvalue
[
10
];
bool
parse_timezone
(
const
char
*
value
)
{
char
*
tok
;
if
(
value
==
NULL
)
{
reset_timezone
();
return
TRUE
;
}
while
((
value
=
get_token
(
&
tok
,
NULL
,
value
))
!=
0
)
{
if
((
defaultTZ
==
NULL
)
&&
(
getenv
(
"TZ"
)
!=
NULL
))
{
defaultTZ
=
getenv
(
"TZ"
);
if
(
defaultTZ
==
NULL
)
{
defaultTZ
=
(
char
*
)
-
1
;
}
else
{
strcpy
(
TZvalue
,
defaultTZ
);
}
}
setenv
(
"TZ"
,
tok
,
TRUE
);
tzset
();
PFREE
(
tok
);
...
...
@@ -415,7 +468,7 @@ parse_timezone(const char *value)
return
TRUE
;
}
/* parse_timezone() */
static
bool
bool
show_timezone
()
{
char
buf
[
64
];
...
...
@@ -431,10 +484,17 @@ show_timezone()
return
TRUE
;
}
/* show_timezone() */
static
bool
bool
reset_timezone
()
{
unsetenv
(
"TZ"
);
if
((
defaultTZ
!=
NULL
)
&&
(
defaultTZ
!=
(
char
*
)
-
1
))
{
setenv
(
"TZ"
,
TZvalue
,
TRUE
);
}
else
{
unsetenv
(
"TZ"
);
}
tzset
();
return
TRUE
;
...
...
@@ -457,12 +517,10 @@ struct VariableParsers
"timezone"
,
parse_timezone
,
show_timezone
,
reset_timezone
},
{
"cost_heap"
,
parse_cost_heap
,
show_cost_heap
,
reset_cost_heap
"cost_heap"
,
parse_cost_heap
,
show_cost_heap
,
reset_cost_heap
},
{
"cost_index"
,
parse_cost_index
,
show_cost_index
,
reset_cost_index
"cost_index"
,
parse_cost_index
,
show_cost_index
,
reset_cost_index
},
{
"geqo"
,
parse_geqo
,
show_geqo
,
reset_geqo
...
...
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