1、 Phenomenon:
schema=# select uuid_generate_v1();
ERROR: function uuid_generate_v1() does not exist
Line 1: select uuid_generate_v1();
^
Warning: No function matches the given name and argument types. You might need to add explicit type casts.
Time: 14.543 ms
2、 Reason:
By default, Postgres has no UUID_ generate_ V1 method, you need to install the extension and enable UUID ossp to use this method.
3、 Solution:
1. Install UUID ossp extension dependent environment
You can use compile install or Yum install, because my environment here is postgres10, yum install, so the yum install extension is preferred.
yum install -y postgresql10-contrib
2. Enable UUID ossp extension
postgres=# create extension "uuid-ossp" ;
CREATE EXTENSION
3. Verification
postgres-# \dx
Installed extensions list
Name | Version | Architecture Mode | Description
-----------+------+------------+-------------------------------------------------
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
uuid-ossp | 1.1 | public | generate universally unique identifiers (UUIDs)
More details
postgres=# \dx+
Object used to extend "plpgsql"
Object description
---------------------------------------
Function plpgsql_call_handler()
function plpgsql_inline_handler(internal)
function plpgsql_validator(oid)
Language plpgsql
(4 rows of records)
object for extending "uuid-ossp"
Object description
----------------------------------
Function uuid_generate_v1()
function uuid_generate_v1mc()
function uuid_generate_v3(uuid,text)
function uuid_generate_v4()
function uuid_generate_v5(uuid,text)
function uuid_nil()
function uuid_ns_dns()
function uuid_ns_oid()
function uuid_ns_url()
function uuid_ns_x500()
(10 lines of records)
Execute again
postgres=# select uuid_generate_v1();
uuid_generate_v1
--------------------------------------
9ffd8cc8-db44-11eb-8952-0050568a41b8
(1 line record)
Read More:
- Vivado Error: [Chipscope 16-302]Could not generate core for dbg_hub.Aborting IP Generate operaion.The current Vivado temporary directory path.
- [Solved] Matlab Code generate error: failed to generate all binary outputs
- Postgres Multiple data insertion error: The ‘default‘ dialect with current database version settings does not support
- [Solved] error: password authentication failed for user “postgres”
- NUXT Run generate error: is not in cwd [How to Solve]
- [Solved] Android Project error: import android.support.v4 (V7). App.activitycompat
- PostgreSQL insert data error: column “XXX” does not exist solution
- [Solved] Kettle Error: ../deploy does not exist, please create it.
- [Solved] The idea Lombok error: Method does not exist
- [Solved] Vscode debug error launch: Program “path” does not exist
- [Solved] Lumen Error: Class redis does not exist
- How to Solve Error: Resource’/Servers’ does not exist
- [Solved] Error PAM in lightdm startup_ Kwallet (5). So does not exist
- [Solved] error: package android.support.design.widget does not exist
- [Solved] GBase 8a V95 Replace Node Error: single vc mode does not support ‘–freenode’
- Room DB Error: AppDatabase_Impl does not exist [How to Solve]
- [Solved] The type or namespace name ‘Service’ does not exist Error
- [Solved] No tf data. Actual error: Fixed Frame [world] does not exist
- Creating test database for alias ‘postgres’… Got an error creating the test database: permission
- [Solved] Postgres Start Error: Job for postgresql.service failed because the control process exited with error code.