Skip to content

Commit 7d60b2a

Browse files
committed
Fix DDL command collection for TRANSFORM
Commit b488c58, which added the DDL command collection feature, neglected to update the code that commit cac7658 had previously added two weeks earlier for the TRANSFORM feature. Reported by Michael Paquier.
1 parent 4028222 commit 7d60b2a

File tree

6 files changed

+32
-4
lines changed

6 files changed

+32
-4
lines changed

src/backend/commands/functioncmds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,7 @@ check_transform_function(Form_pg_proc procstruct)
17401740
/*
17411741
* CREATE TRANSFORM
17421742
*/
1743-
Oid
1743+
ObjectAddress
17441744
CreateTransform(CreateTransformStmt *stmt)
17451745
{
17461746
Oid typeid;
@@ -1938,7 +1938,7 @@ CreateTransform(CreateTransformStmt *stmt)
19381938

19391939
heap_close(relation, RowExclusiveLock);
19401940

1941-
return transformid;
1941+
return myself;
19421942
}
19431943

19441944

src/backend/tcop/utility.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ ProcessUtilitySlow(Node *parsetree,
14381438
break;
14391439

14401440
case T_CreateTransformStmt:
1441-
CreateTransform((CreateTransformStmt *) parsetree);
1441+
address = CreateTransform((CreateTransformStmt *) parsetree);
14421442
break;
14431443

14441444
case T_AlterOpFamilyStmt:

src/include/commands/defrem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extern void SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType);
5151
extern ObjectAddress AlterFunction(AlterFunctionStmt *stmt);
5252
extern ObjectAddress CreateCast(CreateCastStmt *stmt);
5353
extern void DropCastById(Oid castOid);
54-
extern Oid CreateTransform(CreateTransformStmt *stmt);
54+
extern ObjectAddress CreateTransform(CreateTransformStmt *stmt);
5555
extern void DropTransformById(Oid transformOid);
5656
extern void IsThereFunctionInNamespace(const char *proname, int pronargs,
5757
oidvector *proargtypes, Oid nspOid);

src/test/modules/test_ddl_deparse/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ REGRESS = test_ddl_deparse \
1515
create_domain \
1616
create_sequence_1 \
1717
create_table \
18+
create_transform \
1819
alter_table \
1920
create_view \
2021
create_trigger \
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--
2+
-- CREATE_TRANSFORM
3+
--
4+
-- Create a dummy transform
5+
-- The function FROM SQL should have internal as single argument as well
6+
-- as return type. The function TO SQL should have as single argument
7+
-- internal and as return argument the datatype of the transform done.
8+
-- pl/plpgsql does not authorize the use of internal as data type.
9+
CREATE TRANSFORM FOR int LANGUAGE SQL (
10+
FROM SQL WITH FUNCTION varchar_transform(internal),
11+
TO SQL WITH FUNCTION int4recv(internal));
12+
NOTICE: DDL test: type simple, tag CREATE TRANSFORM
13+
DROP TRANSFORM FOR int LANGUAGE SQL;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--
2+
-- CREATE_TRANSFORM
3+
--
4+
5+
-- Create a dummy transform
6+
-- The function FROM SQL should have internal as single argument as well
7+
-- as return type. The function TO SQL should have as single argument
8+
-- internal and as return argument the datatype of the transform done.
9+
-- pl/plpgsql does not authorize the use of internal as data type.
10+
CREATE TRANSFORM FOR int LANGUAGE SQL (
11+
FROM SQL WITH FUNCTION varchar_transform(internal),
12+
TO SQL WITH FUNCTION int4recv(internal));
13+
14+
DROP TRANSFORM FOR int LANGUAGE SQL;

0 commit comments

Comments
 (0)