This article mainly introduces the sql script function to write postgresql database to implement parsing. The example code in the article is very detailed and has a certain reference value for everyone's study or work. Friends in need can refer to it. postgresql creates a Long auto-increment function CREATE SEQUENCE global_id_sequence; CREATE OR REPLACE FUNCTION seq_id(OUT result bigint) AS $$ DECLARE our_epoch bigint := 1314220021721; seq_id bigint; now_millis bigint; -- the id of this DB shard, must be set for each -- schema shard you have - you could pass this as a parameter too shard_id int := 1; BEGIN SELECT nextval('global_id_sequence') % 1024 INTO seq_id; SELECT FLOOR(EXTRACT(EPOCH FROM clock_timestamp()) * 1000) INTO now_millis; result := (now_millis - our_epoch) << 23; result := result | (shard_id << 10); result := result | (seq_id); END; $$LANGUAGE PLPGSQL; <!--alter function seq_id(out bigint) owner to postgres;--> Create sql script postgresql do language plpgsql $$ begin update grade set grade = 90 where sno = '20161003'; end $$ The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Solution to blank page after Vue packaging
After the application is containerized, when the ...
Windows 10 now supports Linux subsystem, saying g...
Table of contents Preface Install the graphics dr...
I feel that the explanation of this.$set on the I...
Websites without https support will gradually be ...
MySQL installation is relatively simple, usually ...
This article shares the specific code of JS+AJAX ...
Table of contents 1. Images 1. What is a mirror? ...
Note: You need to give the parent container a hei...
Table of contents Preface: 1. Understand lock wai...
Screen Introduction Screen is a free software dev...
1. Modify MySQL login settings: # vim /etc/my.cnf...
Table of contents Is setState synchronous or asyn...
You always need data for development. As a server...
Mysql converts query result set into JSON data Pr...