Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] Getting user_type_id for sequences #240

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/backend/commands/sequence.c
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,7 @@ init_params(ParseState *pstate, List *options, bool for_identity,
ListCell *option;
bool reset_max_value = false;
bool reset_min_value = false;
Oid usr_type_id = 0;

*need_seq_rewrite = false;
*owned_by = NIL;
Expand Down Expand Up @@ -1390,6 +1391,8 @@ init_params(ParseState *pstate, List *options, bool for_identity,
*/
if (isInit)
seqdataform->log_cnt = 0;



/* AS type */
if (as_type != NULL)
Expand All @@ -1401,14 +1404,15 @@ init_params(ParseState *pstate, List *options, bool for_identity,
*/

Oid newtypid = 0;


if (pltsql_sequence_datatype_hook)
(* pltsql_sequence_datatype_hook) (pstate,
(*pltsql_sequence_datatype_hook) (pstate,
&newtypid,
for_identity,
as_type,
&max_value,
&min_value);
&min_value,&usr_type_id);

if(!newtypid) newtypid = typenameTypeId(pstate,defGetTypeName(as_type));

Expand Down Expand Up @@ -1619,9 +1623,13 @@ init_params(ParseState *pstate, List *options, bool for_identity,
}

if(pltsql_sequence_validate_increment_hook)
{
(* pltsql_sequence_validate_increment_hook) (seqform->seqincrement,
seqform->seqmax,
seqform->seqmin);
seqform->seqmin
);
seqform->seqtypid = usr_type_id;
}
}

/*
Expand Down
2 changes: 1 addition & 1 deletion src/include/commands/sequence.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ typedef void (*pltsql_sequence_datatype_hook_type) (ParseState *pstate,
bool for_identity,
DefElem *as_type,
DefElem **max_value,
DefElem **min_value);
DefElem **min_value,Oid *usr_type_id);
extern PGDLLIMPORT pltsql_sequence_datatype_hook_type pltsql_sequence_datatype_hook;

/* Sequence nextval hook */
Expand Down