-- 查看solt使用情况
SELECT * FROM pg_replication_slots
-- 释放slot
SELECT pg_drop_replication_slot('slot_name');
-- 查看最多使用slot个数:
SHOW max_replication_slots;
CREATE TABLE kb (
smallint_test smallint ,
int2_test int2 ,
int_test int primary key ,
int4_test int4 ,
int8_test int8 ,
bigint_test bigint ,
double_pre_test double precision ,
decimal_test decimal(38,16) ,
numeric_test numeric(38,16) ,
real_test real ,
float4_test float4 ,
float8_test float8 ,
bigserial_test bigserial ,
character_test character(10) ,
npchar_test bpchar(255) ,
varchar_test varchar(1024) ,
text_test text ,
bytea_test bytea ,
timestamp_test timestamp ,
timestamptz_test timestamptz ,
date_test date ,
time_test time ,
timetz_test timetz ,
bool_test bool ,
bit_test bit ,
xml_test xml ,
json_test json ,
smallserial_test smallserial ,
serial_test serial ,
money_test money ,
interval_test interval ,
uuid_test uuid
)
INSERT INTO kb (smallint_test, int2_test, int_test, int4_test, int8_test, bigint_test, double_pre_test, decimal_test, numeric_test,
real_test, float4_test, float8_test, bigserial_test, character_test, npchar_test, varchar_test, text_test, bytea_test,
timestamp_test, timestamptz_test, date_test, time_test, timetz_test, bool_test, bit_test, xml_test, json_test,
smallserial_test, serial_test, money_test, interval_test, uuid_test)
VALUES (
123,
123, -- 假设这是一个整数字段
1, -- 假设这也是一个整数字段
456, -- 同上
'78912345678', -- 假设这是一个字符串(CHAR 或 VARCHAR)
'123456789', -- 同上
2345.234, -- 假设这是一个浮点数
123456789.123456, -- 同上,可能需要调整精度以适应数据库定义
123456789.123456, -- 同上
123.45, -- 浮点数
123.45, -- 同上
123.456789, -- 同上
10, -- 整数
'A', -- 字符串
'B', -- 字符串
'This is a varchar', -- 字符串
'This is a text', -- 字符串(可能对应TEXT类型)
'0xDEADBEEF', -- 假设这是一个表示二进制数据的字符串
'2023-10-23 10:00:00', -- 日期时间,根据数据库的要求调整格式
'2023-10-23 02:00:00', -- 同上
'2023-10-23', -- 日期
'10:00:00', -- 时间
'02:00:00', -- 时间
FALSE, -- 布尔值
'1', -- 布尔值
'<root><element>Sample 2XML data</element></root>', -- 对于无法加载的字段,使用NULL或适当的默认值
'{"key": "value"}', -- 假设这是一个JSON字符串(如果数据库支持JSON类型)
11, -- 整数
11, -- 同上
25.56, -- 浮点数
INTERVAL '1 day 2 hours 30 minutes', -- 间隔类型,注意格式可能需要根据数据库调整
'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11' -- UUID或其他字符串类型
);
CREATE TABLE employees (
id SERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL,
age INT,
salary DECIMAL(10, 2),
is_manager BOOLEAN DEFAULT FALSE,
hire_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
email VARCHAR(100) UNIQUE,
phone_number VARCHAR(20),
address TEXT
);
INSERT INTO employees (id,name, age, salary, is_manager, email, phone_number, address)
VALUES
(5,'Alice Johnson', 30, 50000.00, FALSE, 'alice@example.com', '123-456-7890', '123 Main St, Anytown, USA'),
(6,'Bob Smith', 35, 65000.50, TRUE, 'bob@example.com', '098-765-4321', '456 Elm St, Anytown, USA'),
(7,'Charlie Davis', 28, 48000.75, FALSE, 'charlie@example.com', '111-222-3333', '789 Oak St, Anytown, USA');
update employees set salary = 777.22 where id = 7;
kingbase 建表语句及插入示例数据
于 2025-02-24 17:43:41 首次发布