@ -98,40 +98,6 @@ static const int PRO_RETURN_SET_COST = 1000;
|
||||
* validator, so as not to produce a NOTICE and then an ERROR for the same
|
||||
* condition.)
|
||||
*/
|
||||
static void CheckIsSerialType(TypeName* t)
|
||||
{
|
||||
bool isSerial = false;
|
||||
/* Check for SERIAL pseudo-types */
|
||||
if (t && list_length(t->names) == 1 && t->pct_type == false) {
|
||||
char* typname = strVal(linitial(t->names));
|
||||
|
||||
if (strcmp(typname, "smallserial") == 0 || strcmp(typname, "serial2") == 0) {
|
||||
isSerial = true;
|
||||
t->names = NIL;
|
||||
t->typeOid = INT2OID;
|
||||
} else if (strcmp(typname, "serial") == 0 || strcmp(typname, "serial4") == 0) {
|
||||
isSerial = true;
|
||||
t->names = NIL;
|
||||
t->typeOid = INT4OID;
|
||||
} else if (strcmp(typname, "bigserial") == 0 || strcmp(typname, "serial8") == 0) {
|
||||
isSerial = true;
|
||||
t->names = NIL;
|
||||
t->typeOid = INT8OID;
|
||||
}
|
||||
|
||||
if (isSerial && t->arrayBounds != NIL) {
|
||||
/*
|
||||
* We have to reject "serial[]" explicitly, because once we've set
|
||||
* typeid, LookupTypeName won't notice arrayBounds. We don't need any
|
||||
* special coding for serial(typmod) though.
|
||||
*/
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("array of serial is not implemented")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void compute_return_type(
|
||||
TypeName* returnType, Oid languageOid, Oid* prorettype_p, bool* returnsSet_p, bool fenced)
|
||||
{
|
||||
@ -145,8 +111,6 @@ static void compute_return_type(
|
||||
*/
|
||||
bool isalter = false;
|
||||
|
||||
CheckIsSerialType(returnType);
|
||||
|
||||
typtup = LookupTypeName(NULL, returnType, NULL);
|
||||
/*
|
||||
* If the type is relation, then we check
|
||||
@ -285,8 +249,6 @@ static void examine_parameter_list(List* parameters, Oid languageOid, const char
|
||||
Type typtup;
|
||||
AclResult aclresult;
|
||||
|
||||
CheckIsSerialType(t);
|
||||
|
||||
typtup = LookupTypeName(NULL, t, NULL);
|
||||
/*
|
||||
* If the type is relation, then we check
|
||||
|
||||
@ -1,62 +0,0 @@
|
||||
--
|
||||
-- testserial
|
||||
--
|
||||
create table tbl_small_serial(a smallserial, b varchar(2));
|
||||
NOTICE: CREATE TABLE will create implicit sequence "tbl_small_serial_a_seq" for serial column "tbl_small_serial.a"
|
||||
|
||||
insert into tbl_small_serial(b) values ('aa');
|
||||
|
||||
create table tbl_serial(a serial, b varchar(2));
|
||||
NOTICE: CREATE TABLE will create implicit sequence "tbl_serial_a_seq" for serial column "tbl_serial.a"
|
||||
|
||||
insert into tbl_serial(b) values ('bb');
|
||||
|
||||
create table tbl_big_serial(a bigserial, b varchar(2));
|
||||
NOTICE: CREATE TABLE will create implicit sequence "tbl_big_serial_a_seq" for serial column "tbl_big_serial.a"
|
||||
|
||||
insert into tbl_big_serial(b) values ('cc');
|
||||
|
||||
CREATE FUNCTION h_testfun6 (c_SMALLSERIAL SMALLSERIAL) RETURNS SMALLSERIAL AS $$
|
||||
BEGIN
|
||||
RETURN c_SMALLSERIAL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE FUNCTION h_testfun7 (c_SERIAL SERIAL) RETURNS SERIAL AS $$
|
||||
BEGIN
|
||||
RETURN c_SERIAL ;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE FUNCTION h_testfun8 (c_BIGSERIAL BIGSERIAL) RETURNS BIGSERIAL AS $$
|
||||
BEGIN
|
||||
RETURN c_BIGSERIAL ;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
SELECT h_testfun6((SELECT a from tbl_small_serial));
|
||||
h_testfun6
|
||||
------------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
|
||||
SELECT h_testfun7((SELECT a from tbl_serial));
|
||||
h_testfun7
|
||||
------------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
|
||||
SELECT h_testfun8((SELECT a from tbl_big_serial));
|
||||
h_testfun8
|
||||
------------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
|
||||
drop table tbl_small_serial;
|
||||
drop table tbl_serial;
|
||||
drop table tbl_big_serial;
|
||||
|
||||
drop function h_testfun6;
|
||||
drop function h_testfun7;
|
||||
drop function h_testfun8;
|
||||
@ -526,9 +526,6 @@ test: vec_sonic_hashjoin_number_prepare
|
||||
test: vec_sonic_hashjoin_number_nospill
|
||||
#test: hw_pwd_complexity
|
||||
|
||||
# test serial function
|
||||
test: test_serial
|
||||
|
||||
test: timeout
|
||||
test: dml
|
||||
#test: iud
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
--
|
||||
-- testserial
|
||||
--
|
||||
create table tbl_small_serial(a smallserial, b varchar(2));
|
||||
|
||||
insert into tbl_small_serial(b) values ('aa');
|
||||
|
||||
create table tbl_serial(a serial, b varchar(2));
|
||||
|
||||
insert into tbl_serial(b) values ('bb');
|
||||
|
||||
create table tbl_big_serial(a bigserial, b varchar(2));
|
||||
|
||||
insert into tbl_big_serial(b) values ('cc');
|
||||
|
||||
CREATE FUNCTION h_testfun6 (c_SMALLSERIAL SMALLSERIAL) RETURNS SMALLSERIAL AS $$
|
||||
BEGIN
|
||||
RETURN c_SMALLSERIAL ;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE FUNCTION h_testfun7 (c_SERIAL SERIAL) RETURNS SERIAL AS $$
|
||||
BEGIN
|
||||
RETURN c_SERIAL ;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE FUNCTION h_testfun8 (c_BIGSERIAL BIGSERIAL) RETURNS BIGSERIAL AS $$
|
||||
BEGIN
|
||||
RETURN c_BIGSERIAL ;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
SELECT h_testfun6((SELECT a from tbl_small_serial));
|
||||
|
||||
SELECT h_testfun7((SELECT a from tbl_serial));
|
||||
|
||||
SELECT h_testfun8((SELECT a from tbl_big_serial));
|
||||
|
||||
drop table tbl_small_serial;
|
||||
drop table tbl_serial;
|
||||
drop table tbl_big_serial;
|
||||
|
||||
drop function h_testfun6;
|
||||
drop function h_testfun7;
|
||||
drop function h_testfun8;
|
||||
Reference in New Issue
Block a user