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
1. Basic lines 2. Special effects (the effects ar...
Table of contents 1. Introduction to MHA 1. What ...
This article uses examples to explain the princip...
Preface: How to get the coordinates of the curren...
This article shares the specific code of the js n...
Table of contents 1. New usage of watch 1.1. Watc...
Table of contents 1. Project Description: 2. Proj...
We are not discussing PHP, JSP or .NET environmen...
Table of contents Immediately execute function fo...
The so-called favicon, which is the abbreviation o...
MySQL v5.7.19 official version (32/64 bit install...
I have recently been following the CSS Animation ...
Nginx Rewrite usage scenarios 1. URL address jump...
Detailed explanation of the misplacement of the in...
In the web pages we make, if we want more people ...