把序列函数转为小写
This commit is contained in:
@ -137,6 +137,12 @@ Datum regprocin(PG_FUNCTION_ARGS)
|
|||||||
return regprocin_booststrap(pro_name_or_oid);
|
return regprocin_booststrap(pro_name_or_oid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (u_sess->attr.attr_sql.enable_ignore_case_in_dquotes) {
|
||||||
|
int length = strlen(pro_name_or_oid);
|
||||||
|
if(length > 0 && pro_name_or_oid[0] == '\"' && pro_name_or_oid[length-1] == '\"')
|
||||||
|
pro_name_or_oid = pg_strtolower(pro_name_or_oid);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Normal case: parse the name into components and see if it matches any
|
* Normal case: parse the name into components and see if it matches any
|
||||||
* pg_proc entries in the current search path.
|
* pg_proc entries in the current search path.
|
||||||
@ -259,6 +265,19 @@ Datum regprocedurein(PG_FUNCTION_ARGS)
|
|||||||
PG_RETURN_OID(result);
|
PG_RETURN_OID(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (u_sess->attr.attr_sql.enable_ignore_case_in_dquotes) {
|
||||||
|
int length = strlen(pro_name_or_oid);
|
||||||
|
int count = 0;
|
||||||
|
if (length > 0) {
|
||||||
|
for(int i = 0; i< length; i++) {
|
||||||
|
if(pro_name_or_oid[i] == '\"')
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
if(count % 2 == 0)
|
||||||
|
pro_name_or_oid = pg_strtolower(pro_name_or_oid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Else it's a name and arguments. Parse the name and arguments, look up
|
* Else it's a name and arguments. Parse the name and arguments, look up
|
||||||
* potential matches in the current namespace search list, and scan to see
|
* potential matches in the current namespace search list, and scan to see
|
||||||
@ -662,6 +681,20 @@ Datum regoperatorin(PG_FUNCTION_ARGS)
|
|||||||
PG_RETURN_OID(result);
|
PG_RETURN_OID(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (u_sess->attr.attr_sql.enable_ignore_case_in_dquotes) {
|
||||||
|
int length = strlen(opr_name_or_oid);
|
||||||
|
int count = 0;
|
||||||
|
if (length > 0) {
|
||||||
|
for(int i = 0; i< length; i++) {
|
||||||
|
if(opr_name_or_oid[i] == '\"')
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
if(count % 2 == 0)
|
||||||
|
opr_name_or_oid = pg_strtolower(opr_name_or_oid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Else it's a name and arguments. Parse the name and arguments, look up
|
* Else it's a name and arguments. Parse the name and arguments, look up
|
||||||
* potential matches in the current namespace search list, and scan to see
|
* potential matches in the current namespace search list, and scan to see
|
||||||
@ -883,6 +916,12 @@ Datum regclassin(PG_FUNCTION_ARGS)
|
|||||||
PG_RETURN_OID(result);
|
PG_RETURN_OID(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (u_sess->attr.attr_sql.enable_ignore_case_in_dquotes) {
|
||||||
|
int length = strlen(class_name_or_oid);
|
||||||
|
if(length > 0 && class_name_or_oid[0] == '\"' && class_name_or_oid[length-1] == '\"')
|
||||||
|
class_name_or_oid = pg_strtolower(class_name_or_oid);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Normal case: parse the name into components and see if it matches any
|
* Normal case: parse the name into components and see if it matches any
|
||||||
* pg_class entries in the current search path.
|
* pg_class entries in the current search path.
|
||||||
@ -997,6 +1036,12 @@ Datum regtypein(PG_FUNCTION_ARGS)
|
|||||||
PG_RETURN_OID(result);
|
PG_RETURN_OID(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (u_sess->attr.attr_sql.enable_ignore_case_in_dquotes) {
|
||||||
|
int length = strlen(typ_name_or_oid);
|
||||||
|
if(length > 0 && typ_name_or_oid[0] == '\"' && typ_name_or_oid[length-1] == '\"')
|
||||||
|
typ_name_or_oid = pg_strtolower(typ_name_or_oid);
|
||||||
|
}
|
||||||
|
|
||||||
/* Else it's a type name, possibly schema-qualified or decorated */
|
/* Else it's a type name, possibly schema-qualified or decorated */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1126,6 +1171,12 @@ Datum regconfigin(PG_FUNCTION_ARGS)
|
|||||||
PG_RETURN_OID(result);
|
PG_RETURN_OID(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (u_sess->attr.attr_sql.enable_ignore_case_in_dquotes) {
|
||||||
|
int length = strlen(cfg_name_or_oid);
|
||||||
|
if(length > 0 && cfg_name_or_oid[0] == '\"' && cfg_name_or_oid[length-1] == '\"')
|
||||||
|
cfg_name_or_oid = pg_strtolower(cfg_name_or_oid);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Normal case: parse the name into components and see if it matches any
|
* Normal case: parse the name into components and see if it matches any
|
||||||
* pg_ts_config entries in the current search path.
|
* pg_ts_config entries in the current search path.
|
||||||
@ -1226,6 +1277,12 @@ Datum regdictionaryin(PG_FUNCTION_ARGS)
|
|||||||
PG_RETURN_OID(result);
|
PG_RETURN_OID(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (u_sess->attr.attr_sql.enable_ignore_case_in_dquotes) {
|
||||||
|
int length = strlen(dict_name_or_oid);
|
||||||
|
if(length > 0 && dict_name_or_oid[0] == '\"' && dict_name_or_oid[length-1] == '\"')
|
||||||
|
dict_name_or_oid = pg_strtolower(dict_name_or_oid);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Normal case: parse the name into components and see if it matches any
|
* Normal case: parse the name into components and see if it matches any
|
||||||
* pg_ts_dict entries in the current search path.
|
* pg_ts_dict entries in the current search path.
|
||||||
|
@ -164,11 +164,115 @@ select * from t2_compfoo;
|
|||||||
CREATE SEQUENCE s1 START 101 CACHE 20;
|
CREATE SEQUENCE s1 START 101 CACHE 20;
|
||||||
CREATE SEQUENCE "S1" START 801 CACHE 90;
|
CREATE SEQUENCE "S1" START 801 CACHE 90;
|
||||||
drop sequence "S1";
|
drop sequence "S1";
|
||||||
|
set enable_ignore_case_in_dquotes=on;
|
||||||
|
WARNING: if tables with the same name but different case already
|
||||||
|
exists in the database, this will result in only being able to
|
||||||
|
manipulate tables with table names that are entirely lowercase.
|
||||||
|
CREATE SEQUENCE "SEQ11" START 101 CACHE 20;
|
||||||
|
SELECT nextval('"SEQ11"');
|
||||||
|
nextval
|
||||||
|
---------
|
||||||
|
101
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
select currval('"SEQ11"');
|
||||||
|
currval
|
||||||
|
---------
|
||||||
|
101
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
select setval('"SEQ11"', 1);
|
||||||
|
setval
|
||||||
|
--------
|
||||||
|
1
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
CREATE TYPE "cOMP" AS (f3 text, f4 int);
|
||||||
|
create function "BB"(b int, a "cOMP") returns int
|
||||||
|
as $$
|
||||||
|
begin
|
||||||
|
b=b+1;
|
||||||
|
return b;
|
||||||
|
end;
|
||||||
|
$$language plpgsql;
|
||||||
|
select regoperatorin('=(int,"inT")');
|
||||||
|
ERROR: type "int" does not exist
|
||||||
|
CONTEXT: referenced column: regoperatorin
|
||||||
|
select regdictionaryin('"dutch_steM"');
|
||||||
|
regdictionaryin
|
||||||
|
-----------------
|
||||||
|
dutch_stem
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
select regconfigin('"Simple"');
|
||||||
|
regconfigin
|
||||||
|
-------------
|
||||||
|
simple
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
select regprocin('"BB"');
|
||||||
|
regprocin
|
||||||
|
-----------
|
||||||
|
bb
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
select '"chAr"'::regtype;
|
||||||
|
regtype
|
||||||
|
---------
|
||||||
|
"char"
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
select regprocedure('"BB"(integer, "Comp")');
|
||||||
|
regprocedure
|
||||||
|
------------------
|
||||||
|
bb(integer,comp)
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
set enable_ignore_case_in_dquotes=off;
|
||||||
|
SELECT nextval('"SEQ11"');
|
||||||
|
ERROR: relation "SEQ11" does not exist
|
||||||
|
LINE 1: SELECT nextval('"SEQ11"');
|
||||||
|
^
|
||||||
|
CONTEXT: referenced column: nextval
|
||||||
|
select currval('"SEQ11"');
|
||||||
|
ERROR: relation "SEQ11" does not exist
|
||||||
|
LINE 1: select currval('"SEQ11"');
|
||||||
|
^
|
||||||
|
CONTEXT: referenced column: currval
|
||||||
|
select setval('"SEQ11"', 1);
|
||||||
|
ERROR: relation "SEQ11" does not exist
|
||||||
|
LINE 1: select setval('"SEQ11"', 1);
|
||||||
|
^
|
||||||
|
CONTEXT: referenced column: setval
|
||||||
|
select regoperatorin('=(int,"inT")');
|
||||||
|
ERROR: type "inT" does not exist
|
||||||
|
CONTEXT: referenced column: regoperatorin
|
||||||
|
select regdictionaryin('"dutch_steM"');
|
||||||
|
ERROR: text search dictionary "dutch_steM" does not exist
|
||||||
|
CONTEXT: referenced column: regdictionaryin
|
||||||
|
select regconfigin('"Simple"');
|
||||||
|
ERROR: text search configuration "Simple" does not exist
|
||||||
|
CONTEXT: referenced column: regconfigin
|
||||||
|
select regprocin('"BB"');
|
||||||
|
ERROR: function ""BB"" does not exist
|
||||||
|
CONTEXT: referenced column: regprocin
|
||||||
|
select '"chAr"'::regtype;
|
||||||
|
ERROR: type "chAr" does not exist
|
||||||
|
LINE 1: select '"chAr"'::regtype;
|
||||||
|
^
|
||||||
|
CONTEXT: referenced column: regtype
|
||||||
|
select regprocedure('"BB"(integer, "Comp")');
|
||||||
|
ERROR: type "Comp" does not exist
|
||||||
|
LINE 1: select regprocedure('"BB"(integer, "Comp")');
|
||||||
|
^
|
||||||
|
CONTEXT: referenced column: regprocedure
|
||||||
-- test enable_ignore_case_in_dquotes=on
|
-- test enable_ignore_case_in_dquotes=on
|
||||||
set enable_ignore_case_in_dquotes=on;
|
set enable_ignore_case_in_dquotes=on;
|
||||||
WARNING: if tables with the same name but different case already
|
WARNING: if tables with the same name but different case already
|
||||||
exists in the database, this will result in only being able to
|
exists in the database, this will result in only being able to
|
||||||
manipulate tables with table names that are entirely lowercase.
|
manipulate tables with table names that are entirely lowercase.
|
||||||
|
drop function "BB";
|
||||||
|
drop TYPE "cOMP";
|
||||||
create table test1 ("A" int, 'a' int);-- error
|
create table test1 ("A" int, 'a' int);-- error
|
||||||
ERROR: syntax error at or near "'a'"
|
ERROR: syntax error at or near "'a'"
|
||||||
LINE 1: create table test1 ("A" int, 'a' int);
|
LINE 1: create table test1 ("A" int, 'a' int);
|
||||||
@ -329,6 +433,7 @@ insert into ¥(¥,"$") values(7,8);
|
|||||||
insert into "啊啊"(",",",") values(10,11);
|
insert into "啊啊"(",",",") values(10,11);
|
||||||
-- clean
|
-- clean
|
||||||
drop table TAB_quote;
|
drop table TAB_quote;
|
||||||
|
drop sequence "SEQ11";
|
||||||
set enable_ignore_case_in_dquotes=off;
|
set enable_ignore_case_in_dquotes=off;
|
||||||
drop materialized view m_test_view;
|
drop materialized view m_test_view;
|
||||||
drop materialized view "M_teSt_view";
|
drop materialized view "M_teSt_view";
|
||||||
|
@ -91,8 +91,44 @@ CREATE SEQUENCE s1 START 101 CACHE 20;
|
|||||||
CREATE SEQUENCE "S1" START 801 CACHE 90;
|
CREATE SEQUENCE "S1" START 801 CACHE 90;
|
||||||
drop sequence "S1";
|
drop sequence "S1";
|
||||||
|
|
||||||
|
set enable_ignore_case_in_dquotes=on;
|
||||||
|
CREATE SEQUENCE "SEQ11" START 101 CACHE 20;
|
||||||
|
SELECT nextval('"SEQ11"');
|
||||||
|
select currval('"SEQ11"');
|
||||||
|
select setval('"SEQ11"', 1);
|
||||||
|
|
||||||
|
CREATE TYPE "cOMP" AS (f3 text, f4 int);
|
||||||
|
|
||||||
|
create function "BB"(b int, a "cOMP") returns int
|
||||||
|
as $$
|
||||||
|
begin
|
||||||
|
b=b+1;
|
||||||
|
return b;
|
||||||
|
end;
|
||||||
|
$$language plpgsql;
|
||||||
|
|
||||||
|
select regoperatorin('=(int,"inT")');
|
||||||
|
select regdictionaryin('"dutch_steM"');
|
||||||
|
select regconfigin('"Simple"');
|
||||||
|
select regprocin('"BB"');
|
||||||
|
select '"chAr"'::regtype;
|
||||||
|
select regprocedure('"BB"(integer, "Comp")');
|
||||||
|
|
||||||
|
set enable_ignore_case_in_dquotes=off;
|
||||||
|
SELECT nextval('"SEQ11"');
|
||||||
|
select currval('"SEQ11"');
|
||||||
|
select setval('"SEQ11"', 1);
|
||||||
|
select regoperatorin('=(int,"inT")');
|
||||||
|
select regdictionaryin('"dutch_steM"');
|
||||||
|
select regconfigin('"Simple"');
|
||||||
|
select regprocin('"BB"');
|
||||||
|
select '"chAr"'::regtype;
|
||||||
|
select regprocedure('"BB"(integer, "Comp")');
|
||||||
|
|
||||||
-- test enable_ignore_case_in_dquotes=on
|
-- test enable_ignore_case_in_dquotes=on
|
||||||
set enable_ignore_case_in_dquotes=on;
|
set enable_ignore_case_in_dquotes=on;
|
||||||
|
drop function "BB";
|
||||||
|
drop TYPE "cOMP";
|
||||||
|
|
||||||
create table test1 ("A" int, 'a' int);-- error
|
create table test1 ("A" int, 'a' int);-- error
|
||||||
insert into test("A","a") values(2,3);-- error
|
insert into test("A","a") values(2,3);-- error
|
||||||
@ -133,6 +169,7 @@ insert into "啊啊"(",",",") values(10,11);
|
|||||||
|
|
||||||
-- clean
|
-- clean
|
||||||
drop table TAB_quote;
|
drop table TAB_quote;
|
||||||
|
drop sequence "SEQ11";
|
||||||
set enable_ignore_case_in_dquotes=off;
|
set enable_ignore_case_in_dquotes=off;
|
||||||
drop materialized view m_test_view;
|
drop materialized view m_test_view;
|
||||||
drop materialized view "M_teSt_view";
|
drop materialized view "M_teSt_view";
|
||||||
|
Reference in New Issue
Block a user