!723 回退代码

Merge pull request !723 from liang/413
This commit is contained in:
opengauss-bot
2021-02-10 14:29:15 +08:00
committed by Gitee
10 changed files with 21 additions and 256 deletions

View File

@ -57,7 +57,6 @@ install:
$(MAKE) -C contrib/hstore $@
$(MAKE) -C src/distribute/kernel/extension/packages $@
$(MAKE) -C contrib/pagehack $@
$(MAKE) -C contrib/pg_stat_statements $@
$(MAKE) -C contrib/pg_xlogdump $@
$(MAKE) -C contrib/gsredistribute $@
$(MAKE) -C src/distribute/kernel/extension/dimsearch $@
@ -71,7 +70,6 @@ install:
$(MAKE) install_oracle_fdw
$(MAKE) install_pldebugger
$(MAKE) -C contrib/postgres_fdw $@
$(MAKE) -C contrib/pg_stat_statements $@
$(MAKE) -C contrib/hstore $@
$(MAKE) -C src/distribute/kernel/extension/packages $@
$(MAKE) -C contrib/gsredistribute $@

View File

@ -17,6 +17,3 @@ top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
exclude_option=-fPIE
override CPPFLAGS := $(filter-out $(exclude_option),$(CPPFLAGS))

View File

@ -135,7 +135,7 @@ typedef struct pgssEntry {
* Global shared state
*/
typedef struct pgssSharedState {
LWLock* lock; /* protects hashtable search/modification */
LWLockId lock; /* protects hashtable search/modification */
int query_size; /* max query length in bytes */
double cur_median_usage; /* current median usage in hashtable */
} pgssSharedState;
@ -172,20 +172,20 @@ typedef struct pgssJumbleState {
/*---- Local variables ----*/
/* Current nesting depth of ExecutorRun+ProcessUtility calls */
static THR_LOCAL int nested_level = 0;
static int nested_level = 0;
/* Saved hook values in case of unload */
static THR_LOCAL shmem_startup_hook_type prev_shmem_startup_hook = NULL;
static THR_LOCAL post_parse_analyze_hook_type prev_post_parse_analyze_hook = NULL;
static THR_LOCAL ExecutorStart_hook_type prev_ExecutorStart = NULL;
static THR_LOCAL ExecutorRun_hook_type prev_ExecutorRun = NULL;
static THR_LOCAL ExecutorFinish_hook_type prev_ExecutorFinish = NULL;
static THR_LOCAL ExecutorEnd_hook_type prev_ExecutorEnd = NULL;
static THR_LOCAL ProcessUtility_hook_type prev_ProcessUtility = NULL;
static shmem_startup_hook_type prev_shmem_startup_hook = NULL;
static post_parse_analyze_hook_type prev_post_parse_analyze_hook = NULL;
static ExecutorStart_hook_type prev_ExecutorStart = NULL;
static ExecutorRun_hook_type prev_ExecutorRun = NULL;
static ExecutorFinish_hook_type prev_ExecutorFinish = NULL;
static ExecutorEnd_hook_type prev_ExecutorEnd = NULL;
static ProcessUtility_hook_type prev_ProcessUtility = NULL;
/* Links to shared memory state */
static THR_LOCAL pgssSharedState* pgss = NULL;
static THR_LOCAL HTAB* pgss_hash = NULL;
static pgssSharedState* pgss = NULL;
static HTAB* pgss_hash = NULL;
/*---- GUC variables ----*/
@ -210,8 +210,8 @@ static bool pgss_save; /* whether to save stats across shutdown */
void _PG_init(void);
void _PG_fini(void);
extern "C" Datum pg_stat_statements_reset(PG_FUNCTION_ARGS);
extern "C" Datum pg_stat_statements(PG_FUNCTION_ARGS);
Datum pg_stat_statements_reset(PG_FUNCTION_ARGS);
Datum pg_stat_statements(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(pg_stat_statements_reset);
PG_FUNCTION_INFO_V1(pg_stat_statements);
@ -260,7 +260,7 @@ void _PG_init(void)
* module isn't active. The functions must protect themselves against
* being called then, however.)
*/
if (!u_sess->misc_cxt.process_shared_preload_libraries_in_progress)
if (!process_shared_preload_libraries_in_progress)
return;
/*
@ -389,7 +389,7 @@ static void pgss_shmem_startup(void)
if (!found) {
/* First time through ... */
pgss->lock = LWLockAssign(LWTRANCHE_BUFFER_CONTENT);
pgss->lock = LWLockAssign();
pgss->query_size = g_instance.attr.attr_common.pgstat_track_activity_query_size;
pgss->cur_median_usage = ASSUMED_MEDIAN_INIT;
}
@ -456,7 +456,7 @@ static void pgss_shmem_startup(void)
buffer_size = temp.query_len + 1;
}
if (fread(buffer, 1, temp.query_len, file) != (size_t)temp.query_len)
if (fread(buffer, 1, temp.query_len, file) != temp.query_len)
goto error;
buffer[temp.query_len] = '\0';
@ -536,7 +536,7 @@ static void pgss_shmem_shutdown(int code, Datum arg)
while ((entry = (pgssEntry*)hash_seq_search(&hash_seq)) != NULL) {
int len = entry->query_len;
if (fwrite(entry, offsetof(pgssEntry, mutex), 1, file) != 1 || fwrite(entry->query, 1, len, file) != (size_t)len)
if (fwrite(entry, offsetof(pgssEntry, mutex), 1, file) != 1 || fwrite(entry->query, 1, len, file) != len)
goto error;
}
@ -748,8 +748,8 @@ static void pgss_ProcessUtility(Node* parsetree, const char* queryString, ParamL
BufferUsage bufusage_start, bufusage;
uint32 queryId;
bufusage_start = *(u_sess->instr_cxt.pg_buffer_usage);
INSTR_TIME_SET_CURRENT(start);
bufusage_start = u_sess->instr_cxt.pg_buffer_usage->INSTR_TIME_SET_CURRENT(start);
nested_level++;
PG_TRY();
{
@ -1661,12 +1661,6 @@ static void JumbleExpr(pgssJumbleState* jstate, Node* node)
JumbleExpr(jstate, (Node*)lfirst(temp));
}
break;
case T_IntList:
foreach(temp, (List *) node)
{
APP_JUMB(lfirst_int(temp));
}
break;
case T_SortGroupClause: {
SortGroupClause* sgc = (SortGroupClause*)node;
@ -1680,7 +1674,6 @@ static void JumbleExpr(pgssJumbleState* jstate, Node* node)
JumbleExpr(jstate, (Node*)gsnode->content);
}
break;
case T_WindowClause: {
WindowClause* wc = (WindowClause*)node;

View File

@ -704,7 +704,7 @@ static void parameter_check_execute_direct(const char* query);
AGGREGATE ALGORITHM ALL ALSO ALTER ALWAYS ANALYSE ANALYZE AND ANY APP ARRAY AS ASC
ASSERTION ASSIGNMENT ASYMMETRIC AT ATTRIBUTE AUDIT AUTHID AUTHORIZATION AUTOEXTEND AUTOMAPPED
BACKWARD BARRIER BEFORE BEGIN_NON_ANOYBLOCK BEGIN_P BETWEEN BIGINT BINARY BINARY_DOUBLE BINARY_FLOAT BINARY_INTEGER BIT BLOB_P BOGUS
BACKWARD BARRIER BEFORE BEGIN_NON_ANOYBLOCK BEGIN_P BETWEEN BIGINT BINARY BINARY_DOUBLE BINARY_INTEGER BIT BLOB_P BOGUS
BOOLEAN_P BOTH BUCKETS BY BYTEAWITHOUTORDER BYTEAWITHOUTORDERWITHEQUAL
CACHE CALL CALLED CASCADE CASCADED CASE CAST CATALOG_P CHAIN CHAR_P
@ -16901,11 +16901,6 @@ Numeric: INT_P
$$ = SystemTypeName("float8");
$$->location = @1;
}
| BINARY_FLOAT
{
$$ = SystemTypeName("float4");
$$->location = @1;
}
| BINARY_INTEGER
{
$$ = SystemTypeName("int4");
@ -20449,7 +20444,6 @@ col_name_keyword:
BETWEEN
| BIGINT
| BINARY_DOUBLE
| BINARY_FLOAT
| BINARY_INTEGER
| BIT
| BOOLEAN_P

View File

@ -493,7 +493,7 @@ extern THR_LOCAL bool stmt_contains_operator_plus;
AGGREGATE ALGORITHM ALL ALSO ALTER ALWAYS ANALYSE ANALYZE AND ANY APP ARRAY AS ASC
ASSERTION ASSIGNMENT ASYMMETRIC AT ATTRIBUTE AUDIT AUDIT_POLICY AUTHID AUTHORIZATION AUTOEXTEND AUTOMAPPED
BACKWARD BARRIER BEFORE BEGIN_P BETWEEN BIGINT BINARY BINARY_DOUBLE BINARY_FLOAT BINARY_INTEGER BIT BLOB_P BOGUS
BACKWARD BARRIER BEFORE BEGIN_P BETWEEN BIGINT BINARY BINARY_DOUBLE BINARY_INTEGER BIT BLOB_P BOGUS
BOOLEAN_P BOTH BUCKETS BY BYTEAWITHOUTORDER BYTEAWITHOUTORDERWITHEQUAL
CACHE CALL CALLED CASCADE CASCADED CASE CAST CATALOG_P CHAIN CHAR_P
@ -7517,11 +7517,6 @@ Numeric: INT_P
$$ = SystemTypeName("float8");
$$->location = @1;
}
| BINARY_FLOAT
{
$$ = SystemTypeName("float4");
$$->location = @1;
}
| BINARY_INTEGER
{
$$ = SystemTypeName("int4");
@ -10908,7 +10903,6 @@ col_name_keyword:
BETWEEN
| BIGINT
| BINARY_DOUBLE
| BINARY_FLOAT
| BINARY_INTEGER
| BIT
| BOOLEAN_P

View File

@ -70,7 +70,6 @@ PG_KEYWORD("between", BETWEEN, COL_NAME_KEYWORD)
PG_KEYWORD("bigint", BIGINT, COL_NAME_KEYWORD)
PG_KEYWORD("binary", BINARY, TYPE_FUNC_NAME_KEYWORD)
PG_KEYWORD("binary_double", BINARY_DOUBLE, COL_NAME_KEYWORD)
PG_KEYWORD("binary_float", BINARY_FLOAT, COL_NAME_KEYWORD)
PG_KEYWORD("binary_integer", BINARY_INTEGER, COL_NAME_KEYWORD)
PG_KEYWORD("bit", BIT, COL_NAME_KEYWORD)
PG_KEYWORD("blob", BLOB_P, UNRESERVED_KEYWORD)

View File

@ -236,85 +236,6 @@ SELECT * FROM test_type order by 1;
1e+308
(3 rows)
DROP TABLE test_type;
/* f.BINARY_FLOAT type */
CREATE TABLE test_type(
my_float BINARY_FLOAT
);
INSERT INTO test_type VALUES (' 0.0');
INSERT INTO test_type VALUES ('1004.30 ');
INSERT INTO test_type VALUES (' -34.84 ');
INSERT INTO test_type VALUES ('1.2345678901234e+20');
INSERT INTO test_type VALUES ('1.2345678901234e-20');
-- test for over and under flow
INSERT INTO test_type VALUES ('10e70');
ERROR: value out of range: overflow
LINE 1: INSERT INTO test_type VALUES ('10e70');
^
CONTEXT: referenced column: my_float
INSERT INTO test_type VALUES ('-10e70');
ERROR: value out of range: overflow
LINE 1: INSERT INTO test_type VALUES ('-10e70');
^
CONTEXT: referenced column: my_float
INSERT INTO test_type VALUES ('10e-70');
ERROR: value out of range: underflow
LINE 1: INSERT INTO test_type VALUES ('10e-70');
^
CONTEXT: referenced column: my_float
INSERT INTO test_type VALUES ('-10e-70');
ERROR: value out of range: underflow
LINE 1: INSERT INTO test_type VALUES ('-10e-70');
^
CONTEXT: referenced column: my_float
-- bad input
INSERT INTO test_type VALUES ('');
INSERT INTO test_type VALUES (' ');
ERROR: invalid input syntax for type real: " "
LINE 1: INSERT INTO test_type VALUES (' ');
^
CONTEXT: referenced column: my_float
INSERT INTO test_type VALUES ('xyz');
ERROR: invalid input syntax for type real: "xyz"
LINE 1: INSERT INTO test_type VALUES ('xyz');
^
CONTEXT: referenced column: my_float
INSERT INTO test_type VALUES ('5.0.0');
ERROR: invalid input syntax for type real: "5.0.0"
LINE 1: INSERT INTO test_type VALUES ('5.0.0');
^
CONTEXT: referenced column: my_float
INSERT INTO test_type VALUES ('5 . 0');
ERROR: invalid input syntax for type real: "5 . 0"
LINE 1: INSERT INTO test_type VALUES ('5 . 0');
^
CONTEXT: referenced column: my_float
INSERT INTO test_type VALUES ('5. 0');
ERROR: invalid input syntax for type real: "5. 0"
LINE 1: INSERT INTO test_type VALUES ('5. 0');
^
CONTEXT: referenced column: my_float
INSERT INTO test_type VALUES (' - 3.0');
ERROR: invalid input syntax for type real: " - 3.0"
LINE 1: INSERT INTO test_type VALUES (' - 3.0');
^
CONTEXT: referenced column: my_float
INSERT INTO test_type VALUES ('123 5');
ERROR: invalid input syntax for type real: "123 5"
LINE 1: INSERT INTO test_type VALUES ('123 5');
^
CONTEXT: referenced column: my_float
SELECT * FROM test_type order by 1;
my_float
-------------
-34.84
0
1.23457e-20
1004.3
1.23457e+20
(6 rows)
DROP TABLE test_type;
/* g.Type BINARY_INTEGER */
CREATE TABLE test_type(

View File

@ -674,85 +674,6 @@ SELECT * FROM test_type order by 1;
1e+308
(3 rows)
DROP TABLE test_type;
/* f.BINARY_FLOAT type */
CREATE TABLE test_type(
my_float BINARY_FLOAT
);
INSERT INTO test_type VALUES (' 0.0');
INSERT INTO test_type VALUES ('1004.30 ');
INSERT INTO test_type VALUES (' -34.84 ');
INSERT INTO test_type VALUES ('1.2345678901234e+20');
INSERT INTO test_type VALUES ('1.2345678901234e-20');
-- test for over and under flow
INSERT INTO test_type VALUES ('10e70');
ERROR: value out of range: overflow
LINE 1: INSERT INTO test_type VALUES ('10e70');
^
CONTEXT: referenced column: my_float
INSERT INTO test_type VALUES ('-10e70');
ERROR: value out of range: overflow
LINE 1: INSERT INTO test_type VALUES ('-10e70');
^
CONTEXT: referenced column: my_float
INSERT INTO test_type VALUES ('10e-70');
ERROR: value out of range: underflow
LINE 1: INSERT INTO test_type VALUES ('10e-70');
^
CONTEXT: referenced column: my_float
INSERT INTO test_type VALUES ('-10e-70');
ERROR: value out of range: underflow
LINE 1: INSERT INTO test_type VALUES ('-10e-70');
^
CONTEXT: referenced column: my_float
-- bad input
INSERT INTO test_type VALUES ('');
INSERT INTO test_type VALUES (' ');
ERROR: invalid input syntax for type real: " "
LINE 1: INSERT INTO test_type VALUES (' ');
^
CONTEXT: referenced column: my_float
INSERT INTO test_type VALUES ('xyz');
ERROR: invalid input syntax for type real: "xyz"
LINE 1: INSERT INTO test_type VALUES ('xyz');
^
CONTEXT: referenced column: my_float
INSERT INTO test_type VALUES ('5.0.0');
ERROR: invalid input syntax for type real: "5.0.0"
LINE 1: INSERT INTO test_type VALUES ('5.0.0');
^
CONTEXT: referenced column: my_float
INSERT INTO test_type VALUES ('5 . 0');
ERROR: invalid input syntax for type real: "5 . 0"
LINE 1: INSERT INTO test_type VALUES ('5 . 0');
^
CONTEXT: referenced column: my_float
INSERT INTO test_type VALUES ('5. 0');
ERROR: invalid input syntax for type real: "5. 0"
LINE 1: INSERT INTO test_type VALUES ('5. 0');
^
CONTEXT: referenced column: my_float
INSERT INTO test_type VALUES (' - 3.0');
ERROR: invalid input syntax for type real: " - 3.0"
LINE 1: INSERT INTO test_type VALUES (' - 3.0');
^
CONTEXT: referenced column: my_float
INSERT INTO test_type VALUES ('123 5');
ERROR: invalid input syntax for type real: "123 5"
LINE 1: INSERT INTO test_type VALUES ('123 5');
^
CONTEXT: referenced column: my_float
SELECT * FROM test_type order by 1;
my_float
-------------
-34.84
0
1.23457e-20
1004.3
1.23457e+20
(6 rows)
DROP TABLE test_type;
/* g.Type BINARY_INTEGER */
CREATE TABLE test_type(

View File

@ -127,32 +127,6 @@ INSERT INTO test_type VALUES(1E+309);
SELECT * FROM test_type order by 1;
DROP TABLE test_type;
/* f.BINARY_FLOAT type */
CREATE TABLE test_type(
my_float BINARY_FLOAT
);
INSERT INTO test_type VALUES (' 0.0');
INSERT INTO test_type VALUES ('1004.30 ');
INSERT INTO test_type VALUES (' -34.84 ');
INSERT INTO test_type VALUES ('1.2345678901234e+20');
INSERT INTO test_type VALUES ('1.2345678901234e-20');
-- test for over and under flow
INSERT INTO test_type VALUES ('10e70');
INSERT INTO test_type VALUES ('-10e70');
INSERT INTO test_type VALUES ('10e-70');
INSERT INTO test_type VALUES ('-10e-70');
-- bad input
INSERT INTO test_type VALUES ('');
INSERT INTO test_type VALUES (' ');
INSERT INTO test_type VALUES ('xyz');
INSERT INTO test_type VALUES ('5.0.0');
INSERT INTO test_type VALUES ('5 . 0');
INSERT INTO test_type VALUES ('5. 0');
INSERT INTO test_type VALUES (' - 3.0');
INSERT INTO test_type VALUES ('123 5');
SELECT * FROM test_type order by 1;
DROP TABLE test_type;
/* g.Type BINARY_INTEGER */
CREATE TABLE test_type(
my_double BINARY_INTEGER

View File

@ -267,32 +267,6 @@ INSERT INTO test_type VALUES(1E+309);
SELECT * FROM test_type order by 1;
DROP TABLE test_type;
/* f.BINARY_FLOAT type */
CREATE TABLE test_type(
my_float BINARY_FLOAT
);
INSERT INTO test_type VALUES (' 0.0');
INSERT INTO test_type VALUES ('1004.30 ');
INSERT INTO test_type VALUES (' -34.84 ');
INSERT INTO test_type VALUES ('1.2345678901234e+20');
INSERT INTO test_type VALUES ('1.2345678901234e-20');
-- test for over and under flow
INSERT INTO test_type VALUES ('10e70');
INSERT INTO test_type VALUES ('-10e70');
INSERT INTO test_type VALUES ('10e-70');
INSERT INTO test_type VALUES ('-10e-70');
-- bad input
INSERT INTO test_type VALUES ('');
INSERT INTO test_type VALUES (' ');
INSERT INTO test_type VALUES ('xyz');
INSERT INTO test_type VALUES ('5.0.0');
INSERT INTO test_type VALUES ('5 . 0');
INSERT INTO test_type VALUES ('5. 0');
INSERT INTO test_type VALUES (' - 3.0');
INSERT INTO test_type VALUES ('123 5');
SELECT * FROM test_type order by 1;
DROP TABLE test_type;
/* g.Type BINARY_INTEGER */
CREATE TABLE test_type(
my_double BINARY_INTEGER