<
8000
script type="application/json" data-target="react-app.embeddedData">{"payload":{"commit":{"oid":"e6170126fc201052b0ec5fc92177eb181d602d26","url":"/postgres/postgres/commit/e6170126fc201052b0ec5fc92177eb181d602d26","authoredDate":"2014-01-17T16:52:06.000-05:00","committedDate":"2014-01-17T16:52:06.000-05:00","shortMessage":null,"shortMessageMarkdown":"\u003cdiv\u003eAdd gen_random_uuid() to contrib/pgcrypto.\u003c/div\u003e","shortMessageMarkdownLink":null,"bodyMessageHtml":"This function provides a way of generating version 4 (pseudorandom) UUIDs\nbased on pgcrypto's PRNG. The main reason for doing this is that the\nOSSP UUID library depended on by contrib/uuid-ossp is becoming more and\nmore of a porting headache, so we need an alternative for people who can't\ninstall that. A nice side benefit though is that this implementation is\nnoticeably faster than uuid-ossp's uuid_generate_v4() function.\n\nOskari Saarenmaa, reviewed by Emre Hasegeli","authors":[{"login":"tglsfdc","displayName":"Tom Lane","avatarUrl":"https://avatars.githubusercontent.com/u/8755309?v=4","path":"/tglsfdc","isGitHub":false}],"committerAttribution":false,"committer":{"login":"tglsfdc","displayName":"Tom Lane","avatarUrl":"https://avatars.githubusercontent.com/u/8755309?v=4","path":"/tglsfdc","isGitHub":false},"parents":["708c529c7fdeba9387825d746752fc6f439d781e"],"globalRelayId":"MDY6Q29tbWl0OTI3NDQyOmU2MTcwMTI2ZmMyMDEwNTJiMGVjNWZjOTIxNzdlYjE4MWQ2MDJkMjY=","sha1":"708c529c7fdeba9387825d746752fc6f439d781e","sha2":"e6170126fc201052b0ec5fc92177eb181d602d26"},"currentUser":null,"repo":{"id":927442,"defaultBranch":"master","name":"postgres","ownerLogin":"postgres","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2010-09-21T11:35:45.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/177543?v=4","public":true,"private":false,"isOrgOwned":true},"diffEntryData":[{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":25,"text":"@@ -26,7 +26,7 @@ MODULE_big\t= pgcrypto","html":"@@ -26,7 +26,7 @@ MODULE_big\t= pgcrypto","displayNoNewLineWarning":false,"position":0,"left":25,"right":25},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":26,"text":" OBJS\t\t= $(SRCS:.c=.o)","html":" \u003cspan class=\"pl-smi\"\u003eOBJS\u003c/span\u003e\t\t= \u003cspan class=\"pl-s\"\u003e$(\u003cspan class=\"pl-smi\"\u003eSRCS:.c=.o\u003c/span\u003e)\u003c/span\u003e","displayNoNewLineWarning":false,"position":1,"left":26,"right":26},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":27,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":2,"left":27,"right":27},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":28,"text":" EXTENSION = pgcrypto","html":" \u003cspan class=\"pl-smi\"\u003eEXTENSION\u003c/span\u003e = pgcrypto","displayNoNewLineWarning":false,"position":3,"left":28,"right":28},{"stylingDirective":null,"type":"DELETION","blobLineNumber":29,"text":"-DATA = pgcrypto--1.0.sql pgcrypto--unpackaged--1.0.sql","html":"-\u003cspan class=\"pl-smi\"\u003eDATA\u003c/span\u003e = pgcrypto--1.\u003cspan class=\"x x-first x-last\"\u003e0\u003c/span\u003e.sql pgcrypto--unpackaged--1.0.sql","displayNoNewLineWarning":false,"position":4,"left":29,"right":28},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":29,"text":"+DATA = pgcrypto--1.1.sql pgcrypto--1.0--1.1.sql pgcrypto--unpackaged--1.0.sql","html":"+\u003cspan class=\"pl-smi\"\u003eDATA\u003c/span\u003e = pgcrypto--1.\u003cspan class=\"x x-first x-last\"\u003e1.sql pgcrypto--1.0--1.1\u003c/span\u003e.sql pgcrypto--unpackaged--1.0.sql","displayNoNewLineWarning":false,"position":5,"left":29,"right":29},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":30,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":6,"left":30,"right":30},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":31,"text":" REGRESS = init md5 sha1 hmac-md5 hmac-sha1 blowfish rijndael \\","html":" \u003cspan class=\"pl-smi\"\u003eREGRESS\u003c/span\u003e = init md5 sha1 hmac-md5 hmac-sha1 blowfish rijndael \u003cspan class=\"pl-cce\"\u003e\\\u003c/span\u003e","displayNoNewLineWarning":false,"position":7,"left":31,"right":31},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":32,"text":" \t$(CF_TESTS) \\","html":" \t\u003cspan class=\"pl-s\"\u003e$(\u003cspan class=\"pl-smi\"\u003eCF_TESTS\u003c/span\u003e)\u003c/span\u003e \u003cspan class=\"pl-cce\"\u003e\\\u003c/span\u003e","displayNoNewLineWarning":false,"position":8,"left":32,"right":32}],"diffNumber":0,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":64,"linesChanged":2,"newTreeEntry":{"lineCount":64,"path":"contrib/pgcrypto/Makefile","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"contrib/pgcrypto/Makefile","mode":100644},"linesAdded":1,"linesDeleted":1,"path":"contrib/pgcrypto/Makefile","pathDigest":"829fa04bb5ac662ed300fe920df74df7d7ef59d7b3e1f99f0b96973252a2f65b","status":"MODIFIED","truncatedReason":null,"oldOid":"708c529c7fdeba9387825d746752fc6f439d781e","newOid":"e6170126fc201052b0ec5fc92177eb181d602d26","copilotChatReference":null,"deletedSha":"708c529c7fdeba9387825d746752fc6f439d781e","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":0,"text":"@@ -0,0 +1,9 @@","html":"@@ -0,0 +1,9 @@","displayNoNewLineWarning":false,"position":0,"left":null,"right":0},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1,"text":"+/* contrib/pgcrypto/pgcrypto--1.0--1.1.sql */","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e/*\u003c/span\u003e contrib/pgcrypto/pgcrypto--1.0--1.1.sql \u003cspan class=\"pl-c\"\u003e*/\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":1,"left":null,"right":1},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2,"text":"+","html":"+","displayNoNewLineWarning":false,"position":2,"left":null,"right":2},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3,"text":"+-- complain if script is sourced in psql, rather than via ALTER EXTENSION","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e complain if script is sourced in psql, rather than via ALTER EXTENSION\u003c/span\u003e","displayNoNewLineWarning":false,"position":3,"left":null,"right":3},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4,"text":"+\\echo Use \"ALTER EXTENSION pgcrypto UPDATE TO '1.1'\" to load this file. \\quit","html":"+\\echo Use \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003eALTER EXTENSION pgcrypto UPDATE TO \u0026#39;1.1\u0026#39;\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003e\u003c/span\u003e to load this file. \\quit","displayNoNewLineWarning":false,"position":4,"left":null,"right":4},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":5,"text":"+","html":"+","displayNoNewLineWarning":false,"position":5,"left":null,"right":5},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":6,"text":"+CREATE FUNCTION gen_random_uuid()","html":"+\u003cspan class=\"pl-k\"\u003eCREATE\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eFUNCTION\u003c/span\u003e \u003cspan class=\"pl-en\"\u003egen_random_uuid\u003c/span\u003e()","displayNoNewLineWarning":false,"position":6,"left":null,"right":6},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":7,"text":"+RETURNS uuid","html":"+RETURNS uuid","displayNoNewLineWarning":false,"position":7,"left":null,"right":7},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":8,"text":"+AS 'MODULE_PATHNAME', 'pg_random_uuid'","html":"+\u003cspan class=\"pl-k\"\u003eAS\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003eMODULE_PATHNAME\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003epg_random_uuid\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":8,"left":null,"right":8},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":9,"text":"+LANGUAGE C VOLATILE;","html":"+LANGUAGE C VOLATILE;","displayNoNewLineWarning":false,"position":9,"left":null,"right":9}],"diffNumber":1,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":9,"linesChanged":9,"newTreeEntry":{"lineCount":9,"path":"contrib/pgcrypto/pgcrypto--1.0--1.1.sql","mode":100644,"isGenerated":false},"oldTreeEntry":null,"linesAdded":9,"linesDeleted":0,"path":"contrib/pgcrypto/pgcrypto--1.0--1.1.sql","pathDigest":"a7efdcebabda2d0a2fde65f471ab7c80b53b21bbb4a3ba96b99d9ce2ae6a4657","status":"ADDED","truncatedReason":null,"oldOid":"708c529c7fdeba9387825d746752fc6f439d781e","newOid":"e6170126fc201052b0ec5fc92177eb181d602d26","copilotChatReference":null,"deletedSha":"708c529c7fdeba9387825d746752fc6f439d781e","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":0,"text":"@@ -1,4 +1,4 @@","html":"@@ -1,4 +1,4 @@","displayNoNewLineWarning":false,"position":0,"left":0,"right":0},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1,"text":"-/* contrib/pgcrypto/pgcrypto--1.0.sql */","html":"-\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e/*\u003c/span\u003e contrib/pgcrypto/pgcrypto--1.\u003cspan class=\"x x-first x-last\"\u003e0\u003c/span\u003e.sql \u003cspan class=\"pl-c\"\u003e*/\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":1,"left":1,"right":0},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1,"text":"+/* contrib/pgcrypto/pgcrypto--1.1.sql */","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e/*\u003c/span\u003e contrib/pgcrypto/pgcrypto--1.\u003cspan class=\"x x-first x-last\"\u003e1\u003c/span\u003e.sql \u003cspan class=\"pl-c\"\u003e*/\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":2,"left":1,"right":1},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":3,"left":2,"right":2},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3,"text":" -- complain if script is sourced in psql, rather than via CREATE EXTENSION","html":" \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e complain if script is sourced in psql, rather than via CREATE EXTENSION\u003c/span\u003e","displayNoNewLineWarning":false,"position":4,"left":3,"right":3},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4,"text":" \\echo Use \"CREATE EXTENSION pgcrypto\" to load this file. \\quit","html":" \\echo Use \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003eCREATE EXTENSION pgcrypto\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003e\u003c/span\u003e to load this file. \\quit","displayNoNewLineWarning":false,"position":5,"left":4,"right":4},{"stylingDirective":null,"type":"HUNK","blobLineNumber":62,"text":"@@ -63,6 +63,11 @@ RETURNS bytea","html":"@@ -63,6 +63,11 @@ RETURNS bytea","displayNoNewLineWarning":false,"position":6,"left":62,"right":62},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":63,"text":" AS 'MODULE_PATHNAME', 'pg_random_bytes'","html":" \u003cspan class=\"pl-k\"\u003eAS\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003eMODULE_PATHNAME\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003epg_random_bytes\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":7,"left":63,"right":63},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":64,"text":" LANGUAGE C VOLATILE STRICT;","html":" LANGUAGE C VOLATILE STRICT;","displayNoNewLineWarning":false,"position":8,"left":64,"right":64},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":65,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":9,"left":65,"right":65},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":66,"text":"+CREATE FUNCTION gen_random_uuid()","html":"+\u003cspan class=\"pl-k\"\u003eCREATE\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eFUNCTION\u003c/span\u003e \u003cspan class=\"pl-en\"\u003egen_random_uuid\u003c/span\u003e()","displayNoNewLineWarning":false,"position":10,"left":65,"right":66},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":67,"text":"+RETURNS uuid","html":"+RETURNS uuid","displayNoNewLineWarning":false,"position":11,"left":65,"right":67},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":68,"text":"+AS 'MODULE_PATHNAME', 'pg_random_uuid'","html":"+\u003cspan class=\"pl-k\"\u003eAS\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003eMODULE_PATHNAME\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003epg_random_uuid\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":12,"left":65,"right":68},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":69,"text":"+LANGUAGE C VOLATILE;","html":"+LANGUAGE C VOLATILE;","displayNoNewLineWarning":false,"position":13,"left":65,"right":69},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":70,"text":"+","html":"+","displayNoNewLineWarning":false,"position":14,"left":65,"right":70},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":71,"text":" --","html":" \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":15,"left":66,"right":71},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":72,"text":" -- pgp_sym_encrypt(data, key)","html":" \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e pgp_sym_encrypt(data, key)\u003c/span\u003e","displayNoNewLineWarning":false,"position":16,"left":67,"right":72},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":73,"text":" --","html":" \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":17,"left":68,"right":73}],"diffNumber":2,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":207,"linesChanged":7,"newTreeEntry":{"lineCount":207,"path":"contrib/pgcrypto/pgcrypto--1.1.sql","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"contrib/pgcrypto/pgcrypto--1.0.sql","mode":100644},"linesAdded":6,"linesDeleted":1,"path":"contrib/pgcrypto/pgcrypto--1.1.sql","pathDigest":"c6b21377ef719e85cae7e4a43e4de844091c2633aa1da904a38ec4017445e426","status":"RENAMED","truncatedReason":null,"oldOid":"708c529c7fdeba9387825d746752fc6f439d781e","newOid":"e6170126fc201052b0ec5fc92177eb181d602d26","copilotChatReference":null,"deletedSha":"708c529c7fdeba9387825d746752fc6f439d781e","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":34,"text":"@@ -35,6 +35,7 @@","html":"@@ -35,6 +35,7 @@","displayNoNewLineWarning":false,"position":0,"left":34,"right":34},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":35,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":1,"left":35,"right":35},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":36,"text":" #include \"parser/scansup.h\"","html":" \u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;parser/scansup.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":2,"left":36,"right":36},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":37,"text":" #include \"utils/builtins.h\"","html":" \u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;utils/builtins.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":3,"left":37,"right":37},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":38,"text":"+#include \"utils/uuid.h\"","html":"+\u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;utils/uuid.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":4,"left":37,"right":38},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":39,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":5,"left":38,"right":39},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":40,"text":" #include \"px.h\"","html":" \u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;px.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":6,"left":39,"right":40},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":41,"text":" #include \"px-crypt.h\"","html":" \u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;px-crypt.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":7,"left":40,"right":41},{"stylingDirective":null,"type":"HUNK","blobLineNumber":443,"text":"@@ -443,6 +444,32 @@ pg_random_bytes(PG_FUNCTION_ARGS)","html":"@@ -443,6 +444,32 @@ pg_random_bytes(PG_FUNCTION_ARGS)","displayNoNewLineWarning":false,"position":8,"left":442,"right":443},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":444,"text":" \tPG_RETURN_BYTEA_P(res);","html":" \t\u003cspan class=pl-en\u003ePG_RETURN_BYTEA_P\u003c/span\u003e(\u003cspan class=pl-s1\u003eres\u003c/span\u003e);","displayNoNewLineWarning":false,"position":9,"left":443,"right":444},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":445,"text":" }","html":" }","displayNoNewLineWarning":false,"position":10,"left":444,"right":445},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":446,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":11,"left":445,"right":446},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":447,"text":"+/* SQL function: gen_random_uuid() returns uuid */","html":"+\u003cspan class=pl-c\u003e/* SQL function: gen_random_uuid() returns uuid */\u003c/span\u003e","displayNoNewLineWarning":false,"position":12,"left":445,"right":447},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":448,"text":"+PG_FUNCTION_INFO_V1(pg_random_uuid);","html":"+\u003cspan class=pl-en\u003ePG_FUNCTION_INFO_V1\u003c/span\u003e(\u003cspan class=pl-s1\u003epg_random_uuid\u003c/span\u003e);","displayNoNewLineWarning":false,"position":13,"left":445,"right":448},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":449,"text":"+","html":"+","displayNoNewLineWarning":false,"position":14,"left":445,"right":449},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":450,"text":"+Datum","html":"+\u003cspan class=pl-smi\u003eDatum\u003c/span\u003e","displayNoNewLineWarning":false,"position":15,"left":445,"right":450},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":451,"text":"+pg_random_uuid(PG_FUNCTION_ARGS)","html":"+\u003cspan class=pl-en\u003epg_random_uuid\u003c/span\u003e(\u003cspan class=pl-c1\u003ePG_FUNCTION_ARGS\u003c/span\u003e)","displayNoNewLineWarning":false,"position":16,"left":445,"right":451},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":452,"text":"+{","html":"+{","displayNoNewLineWarning":false,"position":17,"left":445,"right":452},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":453,"text":"+\tuint8\t *buf = (uint8 *) palloc(UUID_LEN);","html":"+\t\u003cspan class=pl-smi\u003euint8\u003c/span\u003e\t \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003ebuf\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e (\u003cspan class=pl-smi\u003euint8\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e) \u003cspan class=pl-en\u003epalloc\u003c/span\u003e(\u003cspan class=pl-c1\u003eUUID_LEN\u003c/span\u003e);","displayNoNewLineWarning":false,"position":18,"left":445,"right":453},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":454,"text":"+\tint\t\t\terr;","html":"+\t\u003cspan class=pl-smi\u003eint\u003c/span\u003e\t\t\t\u003cspan class=pl-s1\u003eerr\u003c/span\u003e;","displayNoNewLineWarning":false,"position":19,"left":445,"right":454},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":455,"text":"+","html":"+","displayNoNewLineWarning":false,"position":20,"left":445,"right":455},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":456,"text":"+\t/* generate random bits */","html":"+\t\u003cspan class=pl-c\u003e/* generate random bits */\u003c/span\u003e","displayNoNewLineWarning":false,"position":21,"left":445,"right":456},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":457,"text":"+\terr = px_get_pseudo_random_bytes(buf, UUID_LEN);","html":"+\t\u003cspan class=pl-s1\u003eerr\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-en\u003epx_get_pseudo_random_bytes\u003c/span\u003e(\u003cspan class=pl-s1\u003ebuf\u003c/span\u003e, \u003cspan class=pl-c1\u003eUUID_LEN\u003c/span\u003e);","displayNoNewLineWarning":false,"position":22,"left":445,"right":457},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":458,"text":"+\tif (err \u003c 0)","html":"+\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-s1\u003eerr\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026lt;\u003c/span\u003e \u003cspan class=pl-c1\u003e0\u003c/span\u003e)","displayNoNewLineWarning":false,"position":23,"left":445,"right":458},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":459,"text":"+\t\tereport(ERROR,","html":"+\t\t\u003cspan class=pl-en\u003eereport\u003c/span\u003e(\u003cspan class=pl-c1\u003eERROR\u003c/span\u003e,","displayNoNewLineWarning":false,"position":24,"left":445,"right":459},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":460,"text":"+\t\t\t\t(errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),","html":"+\t\t\t\t(\u003cspan class=pl-en\u003eerrcode\u003c/span\u003e(\u003cspan class=pl-c1\u003eERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION\u003c/span\u003e),","displayNoNewLineWarning":false,"position":25,"left":445,"right":460},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":461,"text":"+\t\t\t\t errmsg(\"Random generator error: %s\", px_strerror(err))));","html":"+\t\t\t\t \u003cspan class=pl-en\u003eerrmsg\u003c/span\u003e(\u003cspan class=pl-s\u003e\u0026quot;Random generator error: %s\u0026quot;\u003c/span\u003e, \u003cspan class=pl-en\u003epx_strerror\u003c/span\u003e(\u003cspan class=pl-s1\u003eerr\u003c/span\u003e))));","displayNoNewLineWarning":false,"position":26,"left":445,"right":461},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":462,"text":"+","html":"+","displayNoNewLineWarning":false,"position":27,"left":445,"right":462},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":463,"text":"+\t/*","html":"+\t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":28,"left":445,"right":463},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":464,"text":"+\t * Set magic numbers for a \"version 4\" (pseudorandom) UUID, see","html":"+\u003cspan class=pl-c\u003e\t * Set magic numbers for a \u0026quot;version 4\u0026quot; (pseudorandom) UUID, see\u003c/span\u003e","displayNoNewLineWarning":false,"position":29,"left":445,"right":464},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":465,"text":"+\t * http://tools.ietf.org/html/rfc4122#section-4.4","html":"+\u003cspan class=pl-c\u003e\t * http://tools.ietf.org/html/rfc4122#section-4.4\u003c/span\u003e","displayNoNewLineWarning":false,"position":30,"left":445,"right":465},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":466,"text":"+\t */","html":"+\u003cspan class=pl-c\u003e\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":31,"left":445,"right":466},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":467,"text":"+\tbuf[6] = (buf[6] \u0026 0x0f) | 0x40;\t/* \"version\" field */","html":"+\t\u003cspan class=pl-s1\u003ebuf\u003c/span\u003e[\u003cspan class=pl-c1\u003e6\u003c/span\u003e] \u003cspan class=pl-c1\u003e=\u003c/span\u003e (\u003cspan class=pl-s1\u003ebuf\u003c/span\u003e[\u003cspan class=pl-c1\u003e6\u003c/span\u003e] \u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e \u003cspan class=pl-c1\u003e0x0f\u003c/span\u003e) | \u003cspan class=pl-c1\u003e0x40\u003c/span\u003e;\t\u003cspan class=pl-c\u003e/* \u0026quot;version\u0026quot; field */\u003c/span\u003e","displayNoNewLineWarning":false,"position":32,"left":445,"right":467},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":468,"text":"+\tbuf[8] = (buf[8] \u0026 0x3f) | 0x80;\t/* \"variant\" field */","html":"+\t\u003cspan class=pl-s1\u003ebuf\u003c/span\u003e[\u003cspan class=pl-c1\u003e8\u003c/span\u003e] \u003cspan class=pl-c1\u003e=\u003c/span\u003e (\u003cspan class=pl-s1\u003ebuf\u003c/span\u003e[\u003cspan class=pl-c1\u003e8\u003c/span\u003e] \u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e \u003cspan class=pl-c1\u003e0x3f\u003c/span\u003e) | \u003cspan class=pl-c1\u003e0x80\u003c/span\u003e;\t\u003cspan class=pl-c\u003e/* \u0026quot;variant\u0026quot; field */\u003c/span\u003e","displayNoNewLineWarning":false,"position":33,"left":445,"right":468},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":469,"text":"+","html":"+","displayNoNewLineWarning":false,"position":34,"left":445,"right":469},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":470,"text":"+\tPG_RETURN_UUID_P((pg_uuid_t *) buf);","html":"+\t\u003cspan class=pl-en\u003ePG_RETURN_UUID_P\u003c/span\u003e((\u003cspan class=pl-smi\u003epg_uuid_t\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e) \u003cspan class=pl-s1\u003ebuf\u003c/span\u003e);","displayNoNewLineWarning":false,"position":35,"left":445,"right":470},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":471,"text":"+}","html":"+}","displayNoNewLineWarning":false,"position":36,"left":445,"right":471},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":472,"text":"+","html":"+","displayNoNewLineWarning":false,"position":37,"left":445,"right":472},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":473,"text":" static void *","html":" \u003cspan class=pl-k\u003estatic\u003c/span\u003e \u003cspan class=pl-smi\u003evoid\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e","displayNoNewLineWarning":false,"position":38,"left":446,"right":473},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":474,"text":" find_provider(text *name,","html":" \u003cspan class=pl-en\u003efind_provider\u003c/span\u003e(\u003cspan class=pl-smi\u003etext\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003ename\u003c/span\u003e,","displayNoNewLineWarning":false,"position":39,"left":447,"right":474},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":475,"text":" \t\t\t PFN provider_lookup,","html":" \t\t\t \u003cspan class=pl-smi\u003ePFN\u003c/span\u003e \u003cspan class=pl-s1\u003eprovider_lookup\u003c/span\u003e,","displayNoNewLineWarning":false,"position":40,"left":448,"right":475}],"diffNumber":3,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":496,"linesChanged":27,"newTreeEntry":{"lineCount":496,"path":"contrib/pgcrypto/pgcrypto.c","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"contrib/pgcrypto/pgcrypto.c","mode":100644},"linesAdded":27,"linesDeleted":0,"path":"contrib/pgcrypto/pgcrypto.c","pathDigest":"529766bd9bce9b23baacd68da146029e82163f3b262b12c9ab31bb4c106ac056","status":"MODIFIED","truncatedReason":null,"oldOid":"708c529c7fdeba9387825d746752fc6f439d781e","newOid":"e6170126fc201052b0ec5fc92177eb181d602d26","copilotChatReference":null,"deletedSha":"708c529c7fdeba9387825d746752fc6f439d781e","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":0,"text":"@@ -1,5 +1,5 @@","html":"@@ -1,5 +1,5 @@","displayNoNewLineWarning":false,"position":0,"left":0,"right":0},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1,"text":" # pgcrypto extension","html":" # pgcrypto extension","displayNoNewLineWarning":false,"position":1,"left":1,"right":1},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2,"text":" comment = 'cryptographic functions'","html":" comment = \u0026#39;cryptographic functions\u0026#39;","displayNoNewLineWarning":false,"position":2,"left":2,"right":2},{"stylingDirective":null,"type":"DELETION","blobLineNumber":3,"text":"-default_version = '1.0'","html":"-default_version = \u0026#39;1.\u003cspan class=\"x x-first x-last\"\u003e0\u003c/span\u003e\u0026#39;","displayNoNewLineWarning":false,"position":3,"left":3,"right":2},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3,"text":"+default_version = '1.1'","html":"+default_version = \u0026#39;1.\u003cspan class=\"x x-first x-last\"\u003e1\u003c/span\u003e\u0026#39;","displayNoNewLineWarning":false,"position":4,"left":3,"right":3},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4,"text":" module_pathname = '$libdir/pgcrypto'","html":" module_pathname = \u0026#39;$libdir/pgcrypto\u0026#39;","displayNoNewLineWarning":false,"position":5,"left":4,"right":4},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":5,"text":" relocatable = true","html":" relocatable = true","displayNoNewLineWarning":false,"position":6,"left":5,"right":5}],"diffNumber":4,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":5,"linesChanged":2,"newTreeEntry":{"lineCount":5,"path":"contrib/pgcrypto/pgcrypto.control","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"contrib/pgcrypto/pgcrypto.control","mode":100644},"linesAdded":1,"linesDeleted":1,"path":"contrib/pgcrypto/pgcrypto.control","pathDigest":"ed7dd6d056c7b7853a6f0276ba0b172df3429d7a029c6c6232c0ddcf2def0bc4","status":"MODIFIED","truncatedReason":null,"oldOid":"708c529c7fdeba9387825d746752fc6f439d781e","newOid":"e6170126fc201052b0ec5fc92177eb181d602d26","copilotChatReference":null,"deletedSha":"708c529c7fdeba9387825d746752fc6f439d781e","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":44,"text":"@@ -45,5 +45,6 @@ Datum\t\tpg_decrypt(PG_FUNCTION_ARGS);","html":"@@ -45,5 +45,6 @@ Datum\t\tpg_decrypt(PG_FUNCTION_ARGS);","displayNoNewLineWarning":false,"position":0,"left":44,"right":44},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":45,"text":" Datum\t\tpg_encrypt_iv(PG_FUNCTION_ARGS);","html":" \u003cspan class=pl-smi\u003eDatum\u003c/span\u003e\t\t\u003cspan class=pl-en\u003epg_encrypt_iv\u003c/span\u003e(\u003cspan class=pl-smi\u003ePG_FUNCTION_ARGS\u003c/span\u003e);","displayNoNewLineWarning":false,"position":1,"left":45,"right":45},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":46,"text":" Datum\t\tpg_decrypt_iv(PG_FUNCTION_ARGS);","html":" \u003cspan class=pl-smi\u003eDatum\u003c/span\u003e\t\t\u003cspan class=pl-en\u003epg_decrypt_iv\u003c/span\u003e(\u003cspan class=pl-smi\u003ePG_FUNCTION_ARGS\u003c/span\u003e);","displayNoNewLineWarning":false,"position":2,"left":46,"right":46},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":47,"text":" Datum\t\tpg_random_bytes(PG_FUNCTION_ARGS);","html":" \u003cspan class=pl-smi\u003eDatum\u003c/span\u003e\t\t\u003cspan class=pl-en\u003epg_random_bytes\u003c/span\u003e(\u003cspan class=pl-smi\u003ePG_FUNCTION_ARGS\u003c/span\u003e);","displayNoNewLineWarning":false,"position":3,"left":47,"right":47},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":48,"text":"+Datum\t\tpg_random_uuid(PG_FUNCTION_ARGS);","html":"+\u003cspan class=pl-smi\u003eDatum\u003c/span\u003e\t\t\u0
8000
03cspan class=pl-en\u003epg_random_uuid\u003c/span\u003e(\u003cspan class=pl-smi\u003ePG_FUNCTION_ARGS\u003c/span\u003e);","displayNoNewLineWarning":false,"position":4,"left":47,"right":48},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":49,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":5,"left":48,"right":49},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":50,"text":" #endif","html":" \u003cspan class=pl-k\u003e#endif\u003c/span\u003e","displayNoNewLineWarning":false,"position":6,"left":49,"right":50}],"diffNumber":5,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":50,"linesChanged":1,"newTreeEntry":{"lineCount":50,"path":"contrib/pgcrypto/pgcrypto.h","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"contrib/pgcrypto/pgcrypto.h","mode":100644},"linesAdded":1,"linesDeleted":0,"path":"contrib/pgcrypto/pgcrypto.h","pathDigest":"3f6b23df49be14aae18a8d8c811e95cc7597bee59848302a3ce5029c4eb94df7","status":"MODIFIED","truncatedReason":null,"oldOid":"708c529c7fdeba9387825d746752fc6f439d781e","newOid":"e6170126fc201052b0ec5fc92177eb181d602d26","copilotChatReference":null,"deletedSha":"708c529c7fdeba9387825d746752fc6f439d781e","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":4014,"text":"@@ -4015,6 +4015,8 @@ a0ee-bc99-9c0b-4ef8-bb6d-6bb9-bd38-0a11","html":"@@ -4015,6 +4015,8 @@ a0ee-bc99-9c0b-4ef8-bb6d-6bb9-bd38-0a11","displayNoNewLineWarning":false,"position":0,"left":4014,"right":4014},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4015,"text":" suited for every application. The \u003cxref","html":" suited for every application. The \u0026lt;xref","displayNoNewLineWarning":false,"position":1,"left":4015,"right":4015},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4016,"text":" linkend=\"uuid-ossp\"\u003e module","html":" linkend=\u0026quot;uuid-ossp\u0026quot;\u0026gt; module","displayNoNewLineWarning":false,"position":2,"left":4016,"right":4016},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4017,"text":" provides functions that implement several standard algorithms.","html":" provides functions that implement several standard algorithms.","displayNoNewLineWarning":false,"position":3,"left":4017,"right":4017},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4018,"text":"+ The \u003cxref linkend=\"pgcrypto\"\u003e module also provides a generation","html":"+ The \u0026lt;xref linkend=\u0026quot;pgcrypto\u0026quot;\u0026gt; module also provides a generation","displayNoNewLineWarning":false,"position":4,"left":4017,"right":4018},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4019,"text":"+ function for random UUIDs.","html":"+ function for random UUIDs.","displayNoNewLineWarning":false,"position":5,"left":4017,"right":4019},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4020,"text":" Alternatively, UUIDs could be generated by client applications or","html":" Alternatively, UUIDs could be generated by client applications or","displayNoNewLineWarning":false,"position":6,"left":4018,"right":4020},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4021,"text":" other libraries invoked through a server-side function.","html":" other libraries invoked through a server-side function.","displayNoNewLineWarning":false,"position":7,"left":4019,"right":4021},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4022,"text":" \u003c/para\u003e","html":" \u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":8,"left":4020,"right":4022}],"diffNumber":6,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":4701,"linesChanged":2,"newTreeEntry":{"lineCount":4701,"path":"doc/src/sgml/datatype.sgml","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"doc/src/sgml/datatype.sgml","mode":100644},"linesAdded":2,"linesDeleted":0,"path":"doc/src/sgml/datatype.sgml","pathDigest":"d85637a0b495996d01322900ab72a6cf90c42c09a3d9ad68bbfba960255da146","status":"MODIFIED","truncatedReason":null,"oldOid":"708c529c7fdeba9387825d746752fc6f439d781e","newOid":"e6170126fc201052b0ec5fc92177eb181d602d26","copilotChatReference":null,"deletedSha":"708c529c7fdeba9387825d746752fc6f439d781e","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":1083,"text":"@@ -1084,6 +1084,17 @@ gen_random_bytes(count integer) returns bytea","html":"@@ -1084,6 +1084,17 @@ gen_random_bytes(count integer) returns bytea","displayNoNewLineWarning":false,"position":0,"left":1083,"right":1083},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1084,"text":" At most 1024 bytes can be extracted at a time. This is to avoid","html":" At most 1024 bytes can be extracted at a time. This is to avoid","displayNoNewLineWarning":false,"position":1,"left":1084,"right":1084},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1085,"text":" draining the randomness generator pool.","html":" draining the randomness generator pool.","displayNoNewLineWarning":false,"position":2,"left":1085,"right":1085},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1086,"text":" \u003c/para\u003e","html":" \u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":3,"left":1086,"right":1086},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1087,"text":"+","html":"+","displayNoNewLineWarning":false,"position":4,"left":1086,"right":1087},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1088,"text":"+ \u003cindexterm\u003e","html":"+ \u0026lt;indexterm\u0026gt;","displayNoNewLineWarning":false,"position":5,"left":1086,"right":1088},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1089,"text":"+ \u003cprimary\u003egen_random_uuid\u003c/primary\u003e","html":"+ \u0026lt;primary\u0026gt;gen_random_uuid\u0026lt;/primary\u0026gt;","displayNoNewLineWarning":false,"position":6,"left":1086,"right":1089},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1090,"text":"+ \u003c/indexterm\u003e","html":"+ \u0026lt;/indexterm\u0026gt;","displayNoNewLineWarning":false,"position":7,"left":1086,"right":1090},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1091,"text":"+","html":"+","displayNoNewLineWarning":false,"position":8,"left":1086,"right":1091},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1092,"text":"+\u003csynopsis\u003e","html":"+\u0026lt;synopsis\u0026gt;","displayNoNewLineWarning":false,"position":9,"left":1086,"right":1092},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1093,"text":"+gen_random_uuid() returns uuid","html":"+gen_random_uuid() returns uuid","displayNoNewLineWarning":false,"position":10,"left":1086,"right":1093},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1094,"text":"+\u003c/synopsis\u003e","html":"+\u0026lt;/synopsis\u0026gt;","displayNoNewLineWarning":false,"position":11,"left":1086,"right":1094},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1095,"text":"+ \u003cpara\u003e","html":"+ \u0026lt;para\u0026gt;","displayNoNewLineWarning":false,"position":12,"left":1086,"right":1095},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1096,"text":"+ Returns a version 4 (random) UUID.","html":"+ Returns a version 4 (random) UUID.","displayNoNewLineWarning":false,"position":13,"left":1086,"right":1096},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1097,"text":"+ \u003c/para\u003e","html":"+ \u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":14,"left":1086,"right":1097},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1098,"text":" \u003c/sect2\u003e","html":" \u0026lt;/sect2\u0026gt;","displayNoNewLineWarning":false,"position":15,"left":1087,"right":1098},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1099,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":16,"left":1088,"right":1099},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1100,"text":" \u003csect2\u003e","html":" \u0026lt;sect2\u0026gt;","displayNoNewLineWarning":false,"position":17,"left":1089,"right":1100}],"diffNumber":7,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":1390,"linesChanged":11,"newTreeEntry":{"lineCount":1390,"path":"doc/src/sgml/pgcrypto.sgml","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"doc/src/sgml/pgcrypto.sgml","mode":100644},"linesAdded":11,"linesDeleted":0,"path":"doc/src/sgml/pgcrypto.sgml","pathDigest":"8a1f344b6412774674aea879d8d423ae771dc9266d54ff6671d8f6631f541d74","status":"MODIFIED","truncatedReason":null,"oldOid":"708c529c7fdeba9387825d746752fc6f439d781e","newOid":"e6170126fc201052b0ec5fc92177eb181d602d26","copilotChatReference":null,"deletedSha":"708c529c7fdeba9387825d746752fc6f439d781e","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":17,"text":"@@ -18,6 +18,15 @@","html":"@@ -18,6 +18,15 @@","displayNoNewLineWarning":false,"position":0,"left":17,"right":17},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":18,"text":" \u003culink url=\"http://www.ossp.org/pkg/lib/uuid/\"\u003e\u003c/ulink\u003e.","html":" \u0026lt;ulink url=\u0026quot;http://www.ossp.org/pkg/lib/uuid/\u0026quot;\u0026gt;\u0026lt;/ulink\u0026gt;.","displayNoNewLineWarning":false,"position":1,"left":18,"right":18},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":19,"text":" \u003c/para\u003e","html":" \u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":2,"left":19,"right":19},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":20,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":3,"left":20,"right":20},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":21,"text":"+ \u003cnote\u003e","html":"+ \u0026lt;note\u0026gt;","displayNoNewLineWarning":false,"position":4,"left":20,"right":21},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":22,"text":"+ \u003cpara\u003e","html":"+ \u0026lt;para\u0026gt;","displayNoNewLineWarning":false,"position":5,"left":20,"right":22},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":23,"text":"+ The OSSP UUID library is not well maintained, and is becoming increasingly","html":"+ The OSSP UUID library is not well maintained, and is becoming increasingly","displayNoNewLineWarning":false,"position":6,"left":20,"right":23},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":24,"text":"+ difficult to port to newer platforms. If you only need randomly-generated","html":"+ difficult to port to newer platforms. If you only need randomly-generated","displayNoNewLineWarning":false,"position":7,"left":20,"right":24},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":25,"text":"+ (version 4) UUIDs, consider using the \u003cfunction\u003egen_random_uuid()\u003c/\u003e","html":"+ (version 4) UUIDs, consider using the \u0026lt;function\u0026gt;gen_random_uuid()\u0026lt;/\u0026gt;","displayNoNewLineWarning":false,"position":8,"left":20,"right":25},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":26,"text":"+ function from the \u003cxref linkend=\"pgcrypto\"\u003e module instead.","html":"+ function from the \u0026lt;xref linkend=\u0026quot;pgcrypto\u0026quot;\u0026gt; module instead.","displayNoNewLineWarning":false,"position":9,"left":20,"right":26},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":27,"text":"+ \u003c/para\u003e","html":"+ \u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":10,"left":20,"right":27},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":28,"text":"+ \u003c/note\u003e","html":"+ \u0026lt;/note\u0026gt;","displayNoNewLineWarning":false,"position":11,"left":20,"right":28},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":29,"text":"+","html":"+","displayNoNewLineWarning":false,"position":12,"left":20,"right":29},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":30,"text":" \u003csect2\u003e","html":" \u0026lt;sect2\u0026gt;","displayNoNewLineWarning":false,"position":13,"left":21,"right":30},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":31,"text":" \u003ctitle\u003e\u003cliteral\u003euuid-ossp\u003c/literal\u003e Functions\u003c/title\u003e","html":" \u0026lt;title\u0026gt;\u0026lt;literal\u0026gt;uuid-ossp\u0026lt;/literal\u0026gt; Functions\u0026lt;/title\u0026gt;","displayNoNewLineWarning":false,"position":14,"left":22,"right":31},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":32,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":15,"left":23,"right":32}],"diffNumber":8,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":184,"linesChanged":9,"newTreeEntry":{"lineCount":184,"path":"doc/src/sgml/uuid-ossp.sgml","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"doc/src/sgml/uuid-ossp.sgml","mode":100644},"linesAdded":9,"linesDeleted":0,"path":"doc/src/sgml/uuid-ossp.sgml","pathDigest":"cb9a606ec7bb0d0a8aa46db078e7fe706753ec7826e2bb760abd3182b8c2a09a","status":"MODIFIED","truncatedReason":null,"oldOid":"708c529c7fdeba9387825d746752fc6f439d781e","newOid":"e6170126fc201052b0ec5fc92177eb181d602d26","copilotChatReference":null,"deletedSha":"708c529c7fdeba9387825d746752fc6f439d781e","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null}],"splitViewPreference":"unified","ignoreWhitespace":false,"repoOwnerGlobalRelayId":"MDEyOk9yZ2FuaXphdGlvbjE3NzU0Mw==","commentsPreference":"visible","diffLineSpacingPreference":"relaxed","useMonospaceFont":false,"pasteUrlLinkAsPlainText":false,"userNotices":[],"path":"/postgres/postgres/commit/e6170126fc201052b0ec5fc92177eb181d602d26","fileTreeExpanded":true,"headerInfo":{"additions":67,"deletions":3,"filesChanged":9,"filesChangedString":"9"},"moreDiffsToLoad":false,"asyncDiffLoadInfo":{"startIndex":9,"truncated":false,"byteCount":3926,"lineShownCount":135},"commentInfo":{"canComment":false,"locked":false,"canLock":false,"repoArchived":false},"csrf_tokens":{"/users/diffview?diff=split":{"post":"nq747-TX_cxiXmrYpnlwhjzGSeOiL4S7Snj2C6MQnthH7-_KEOBhA5MS1FaUCwq6Mf0NZ5KBWVJgOKueNKj82Q"},"/users/diffview?diff=unified":{"post":"QUYpt6pjZ_Xxp4rHwoUFjJJhYVvsVXiNkQ_dg4fEfV-YBz6SXlT7OgDrNEnw93-wn1ol39z7pWS7T4AWEHwfXg"},"/notifications/thread":{"post":"csJiXLy2mdF8rPAGrGaAlqQbM9Acjvzu1tQI-lTvRjap2NiOnpDqKAX9p8aY6sA7zIXceSMsEv1DESVDGlb7nw"}}},"title":"Add gen_random_uuid() to contrib/pgcrypto. · postgres/postgres@e617012","appPayload":{"helpUrl":"https://docs.github.com","findInDiffWorkerPath":"/assets-cdn/worker/find-in-diff-worker-2bfe39677d14.js","enabled_features":{"diff_ux_refresh_beta":false,"diff_inline_comments":true,"diff_ux_refresh_ssr_five":false,"diff_ux_refresh_ssr_ten":false,"react_diff_line_type_character_correction":true}}}
File tree Expand file tree Collapse file tree 9 files changed +67
-3
lines changed Expand file tree Collapse file tree 9 files changed +67
-3
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ MODULE_big = pgcrypto
26
26
OBJS = $(SRCS:.c=.o )
27
27
28
28
EXTENSION = pgcrypto
29
- DATA = pgcrypto--1.0 .sql pgcrypto--unpackaged--1.0.sql
29
+ DATA = pgcrypto--1.1.sql pgcrypto--1.0--1.1 .sql pgcrypto--unpackaged--1.0.sql
30
30
31
31
REGRESS = init md5 sha1 hmac-md5 hmac-sha1 blowfish rijndael \
32
32
$(CF_TESTS ) \
Original file line number Diff line number Diff line change
1
+ /* contrib/pgcrypto/pgcrypto--1.0--1.1.sql */
2
+
3
+ -- complain if script is sourced in psql, rather than via ALTER EXTENSION
4
+ \echo Use " ALTER EXTENSION pgcrypto UPDATE TO '1.1'" to load this file. \quit
5
+
6
+ CREATE FUNCTION gen_random_uuid ()
7
+ RETURNS uuid
8
+ AS ' MODULE_PATHNAME' , ' pg_random_uuid'
9
+ LANGUAGE C VOLATILE;
Original file line number Diff line number Diff line change 1
- /* contrib/pgcrypto/pgcrypto--1.0 .sql */
1
+ /* contrib/pgcrypto/pgcrypto--1.1 .sql */
2
2
3
3
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
4
4
\echo Use " CREATE EXTENSION pgcrypto" to load this file. \quit
@@ -63,6 +63,11 @@ RETURNS bytea
63
63
AS ' MODULE_PATHNAME' , ' pg_random_bytes'
64
64
LANGUAGE C VOLATILE STRICT;
65
65
66
+ CREATE FUNCTION gen_ra
10000
ndom_uuid ()
67
+ RETURNS uuid
68
+ AS ' MODULE_PATHNAME' , ' pg_random_uuid'
69
+ LANGUAGE C VOLATILE;
70
+
66
71
--
67
72
-- pgp_sym_encrypt(data, key)
68
73
--
Original file line number Diff line number Diff line change 35
35
36
36
#include "parser/scansup.h"
37
37
#include "utils/builtins.h"
38
+ #include "utils/uuid.h"
38
39
39
40
#include "px.h"
40
41
#include "px-crypt.h"
@@ -443,6 +444,32 @@ pg_random_bytes(PG_FUNCTION_ARGS)
443
444
PG_RETURN_BYTEA_P (res );
444
445
}
445
446
447
+ /* SQL function: gen_random_uuid() returns uuid */
448
+ PG_FUNCTION_INFO_V1 (pg_random_uuid );
449
+
450
+ Datum
451
+ pg_random_uuid (PG_FUNCTION_ARGS )
452
+ {
453
+ uint8 * buf = (uint8 * ) palloc (UUID_LEN );
454
+ int err ;
455
+
456
+ /* generate random bits */
457
+ err = px_get_pseudo_random_bytes (buf , UUID_LEN );
458
+ if (err < 0 )
459
+ ereport (ERROR ,
460
+ (errcode (ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION ),
461
+ errmsg ("Random generator error: %s" , px_strerror (err ))));
462
+
463
+ /*
464
+ * Set magic numbers for a "version 4" (pseudorandom) UUID, see
465
+ * http://tools.ietf.org/html/rfc4122#section-4.4
466
+ */
467
+ buf [6 ] = (buf [6 ] & 0x0f ) | 0x40 ; /* "version" field */
468
+ buf [8 ] = (buf [8 ] & 0x3f ) | 0x80 ; /* "variant" field */
469
+
470
+ PG_RETURN_UUID_P ((pg_uuid_t * ) buf );
471
+ }
472
+
446
473
static void *
447
474
find_provider (text * name ,
448
475
PFN provider_lookup ,
Original file line number Diff line number Diff line change 1
1
# pgcrypto extension
2
2
comment = 'cryptographic functions'
3
- default_version = '1.0 '
3
+ default_version = '1.1 '
4
4
module_pathname = '$libdir/pgcrypto'
5
5
relocatable = true
Original file line number Diff line number Diff line change @@ -45,5 +45,6 @@ Datum pg_decrypt(PG_FUNCTION_ARGS);
45
45
Datum pg_encrypt_iv (PG_FUNCTION_ARGS );
46
46
Datum pg_decrypt_iv (PG_FUNCTION_ARGS );
47
47
Datum pg_random_bytes (PG_FUNCTION_ARGS );
48
+ Datum pg_random_uuid (PG_FUNCTION_ARGS );
48
49
49
50
#endif
Original file line number Diff line number Diff line change @@ -4015,6 +4015,8 @@ a0ee-bc99-9c0b-4ef8-bb6d-6bb9-bd38-0a11
4015
4015
suited for every application. The <xref
4016
4016
linkend="uuid-ossp"> module
4017
4017
provides functions that implement several standard algorithms.
4018
+ The <xref linkend="pgcrypto"> module also provides a generation
4019
+ function for random UUIDs.
4018
4020
Alternatively, UUIDs could be generated by client applications or
4019
4021
other libraries invoked through a server-side function.
4020
4022
</para>
Original file line number Diff line number Diff line change @@ -1084,6 +1084,17 @@ gen_random_bytes(count integer) returns bytea
1084
1084
At most 1024 bytes can be extracted at a time. This is to avoid
1085
1085
draining the randomness generator pool.
1086
1086
</para>
1087
+
1088
+ <indexterm>
1089
+ <primary>gen_random_uuid</primary>
1090
+ </indexterm>
1091
+
1092
+ <synopsis>
1093
+ gen_random_uuid() returns uuid
1094
+ </synopsis>
1095
+ <para>
1096
+ Returns a version 4 (random) UUID.
1097
+ </para>
1087
1098
</sect2>
1088
1099
1089
1100
<sect2>
Original file line number Diff line number Diff line change 18
18
<ulink url="http://www.ossp.org/pkg/lib/uuid/"></ulink>.
19
19
</para>
20
20
21
+ <note>
22
+ <para>
23
+ The OSSP UUID library is not well maintained, and is becoming increasingly
24
+ difficult to port to newer platforms. If you only need randomly-generated
25
+ (version 4) UUIDs, consider using the <function>gen_random_uuid()</>
26
+ function from the <xref linkend="pgcrypto"> module instead.
27
+ </para>
28
+ </note>
29
+
21
30
<sect2>
22
31
<title><literal>uuid-ossp</literal> Functions</title>
23
32
You can’t perform that action at this time.
0 commit comments