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
Joint Index The definition of the joint index in ...
Swap memory mainly means that when the physical m...
Table of contents 01 What is Kubernetes? 02 The d...
Original article, please indicate the author and ...
Table of contents introduction Indexing principle...
Preface The origin is a question 1: If your umask...
Table of contents 1. What is dynamic typing? 2. D...
Source: http://www.ruoyi.vip/ import Vue from ...
I encountered a problem when I turned on my lapto...
This is what happened. Today I was playing with G...
Preface Basically, programmers in the workplace u...
1. Always close HTML tags In the source code of p...
Today we are going to implement a Thunder Fighter...
Table of contents Preface Install the graphics dr...
Prepare war package 1. Prepare the existing Sprin...