diff options
author | Pallavi Sontakke | 2016-07-20 09:42:04 +0000 |
---|---|---|
committer | Pavan Deolasee | 2016-10-18 10:07:23 +0000 |
commit | 7c2402d025e01e77a90e5a497ea95d38587922fe (patch) | |
tree | d0b0c50e4e3abf165bf5d7899e01b68eed71880c | |
parent | 75ee2cc21bda92038086be15d50efd941bfba221 (diff) |
Correct stable function in test
-rw-r--r-- | src/test/regress/expected/xl_functions.out | 27 | ||||
-rwxr-xr-x | src/test/regress/sql/xl_functions.sql | 16 |
2 files changed, 16 insertions, 27 deletions
diff --git a/src/test/regress/expected/xl_functions.out b/src/test/regress/expected/xl_functions.out index 6133401b1b..d33919cb0d 100644 --- a/src/test/regress/expected/xl_functions.out +++ b/src/test/regress/expected/xl_functions.out @@ -21,23 +21,19 @@ SELECT * from xl_funct2; --STABLE functions -- checking STABLE function in DEFAULT of non-distribution column -create table xl_users (userid text, seq int, name text); -insert into xl_users values ('id',1,'pallavi'); -insert into xl_users values ('id2',2,'xyz'); -create or replace function xl_get_first_user() returns text as -$$ SELECT name FROM xl_users ORDER BY userid LIMIT 1; $$ -language sql stable; +create function xl_nochange(text) returns text + as 'select $1 limit 1' language sql stable; CREATE TABLE xl_funct3( a integer, b integer, - c text DEFAULT xl_get_first_user() + c text DEFAULT xl_nochange('hello') ) DISTRIBUTE BY HASH(a); INSERT INTO xl_funct3(a,b) VALUES (1,2);--c should be pallavi INSERT INTO xl_funct3(a,b,c) VALUES (3,4,'qwerty');-- c should be qwerty SELECT * from xl_funct3; - a | b | c ----+---+--------- - 1 | 2 | pallavi + a | b | c +---+---+-------- + 1 | 2 | hello 3 | 4 | qwerty (2 rows) @@ -45,15 +41,15 @@ SELECT * from xl_funct3; CREATE TABLE xl_funct4( a integer, b integer, - c text DEFAULT xl_get_first_user() + c text DEFAULT xl_nochange('hello') ) DISTRIBUTE BY HASH(c); INSERT INTO xl_funct4(a,b) VALUES (1,2);--c should be pallavi INSERT INTO xl_funct4(a,b,c) VALUES (3,4,'qwerty');-- c should be qwerty SELECT * from xl_funct4; - a | b | c ----+---+--------- - 1 | 2 | pallavi + a | b | c +---+---+-------- 3 | 4 | qwerty + 1 | 2 | hello (2 rows) --VOLATILE functions @@ -113,7 +109,6 @@ DROP SEQUENCE xl_INSERT_SEQ; DROP TABLE xl_funct2; DROP TABLE xl_funct3; DROP TABLE xl_funct4; -DROP TABLE xl_users; -DROP FUNCTION xl_get_first_user(); +DROP FUNCTION xl_nochange(text); DROP TABLE xl_funct5; DROP FUNCTION xl_get_curr_decade(); diff --git a/src/test/regress/sql/xl_functions.sql b/src/test/regress/sql/xl_functions.sql index 2b485c16fd..59b1f9e615 100755 --- a/src/test/regress/sql/xl_functions.sql +++ b/src/test/regress/sql/xl_functions.sql @@ -20,18 +20,13 @@ SELECT * from xl_funct2; --STABLE functions -- checking STABLE function in DEFAULT of non-distribution column -create table xl_users (userid text, seq int, name text); -insert into xl_users values ('id',1,'pallavi'); -insert into xl_users values ('id2',2,'xyz'); - -create or replace function xl_get_first_user() returns text as -$$ SELECT name FROM xl_users ORDER BY userid LIMIT 1; $$ -language sql stable; +create function xl_nochange(text) returns text + as 'select $1 limit 1' language sql stable; CREATE TABLE xl_funct3( a integer, b integer, - c text DEFAULT xl_get_first_user() + c text DEFAULT xl_nochange('hello') ) DISTRIBUTE BY HASH(a); INSERT INTO xl_funct3(a,b) VALUES (1,2);--c should be pallavi @@ -43,7 +38,7 @@ SELECT * from xl_funct3; CREATE TABLE xl_funct4( a integer, b integer, - c text DEFAULT xl_get_first_user() + c text DEFAULT xl_nochange('hello') ) DISTRIBUTE BY HASH(c); INSERT INTO xl_funct4(a,b) VALUES (1,2);--c should be pallavi @@ -101,7 +96,6 @@ DROP SEQUENCE xl_INSERT_SEQ; DROP TABLE xl_funct2; DROP TABLE xl_funct3; DROP TABLE xl_funct4; -DROP TABLE xl_users; -DROP FUNCTION xl_get_first_user(); +DROP FUNCTION xl_nochange(text); DROP TABLE xl_funct5; DROP FUNCTION xl_get_curr_decade(); |