mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-20 04:23:22 +02:00
34 lines
694 B
MySQL
34 lines
694 B
MySQL
|
-- SQL code to define new sequence utilities
|
||
|
|
||
|
-- Set a new sequence value
|
||
|
--
|
||
|
create function set_currval(text, int4) returns int4
|
||
|
as 'MODULE_PATHNAME'
|
||
|
language 'C';
|
||
|
|
||
|
-- Increment the value of sequence
|
||
|
--
|
||
|
-- select next_id('sequence_name');
|
||
|
--
|
||
|
create function next_id(text) returns int4
|
||
|
as 'MODULE_PATHNAME'
|
||
|
language 'C';
|
||
|
|
||
|
-- Return the last value set for a sequence
|
||
|
--
|
||
|
-- select last_id('sequence_name');
|
||
|
--
|
||
|
create function last_id(text) returns int4
|
||
|
as 'MODULE_PATHNAME'
|
||
|
language 'C';
|
||
|
|
||
|
-- Set the current value of a sequence
|
||
|
--
|
||
|
-- select set_last_id('sequence_name', 1);
|
||
|
--
|
||
|
create function set_last_id(text,int4) returns int4
|
||
|
as 'MODULE_PATHNAME'
|
||
|
language 'C';
|
||
|
|
||
|
-- end of file
|