default添加以f/d结尾的浮点数支持
This commit is contained in:
@ -8078,6 +8078,24 @@ ColConstraintElem:
|
||||
n->cooked_expr = NULL;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| DEFAULT FCONST_F
|
||||
{
|
||||
Constraint *n = makeNode(Constraint);
|
||||
n->contype = CONSTR_DEFAULT;
|
||||
n->location = @1;
|
||||
n->raw_expr = makeFloatConst($2, @2);
|
||||
n->cooked_expr = NULL;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| DEFAULT FCONST_D
|
||||
{
|
||||
Constraint *n = makeNode(Constraint);
|
||||
n->contype = CONSTR_DEFAULT;
|
||||
n->location = @1;
|
||||
n->raw_expr = makeFloatConst($2, @2);;
|
||||
n->cooked_expr = NULL;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| ON_UPDATE_TIME UPDATE b_expr
|
||||
{
|
||||
#ifndef ENABLE_MULTIPLE_NODES
|
||||
|
||||
@ -5560,6 +5560,24 @@ ColConstraintElem:
|
||||
n->cooked_expr = NULL;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| DEFAULT FCONST_F
|
||||
{
|
||||
Constraint *n = makeNode(Constraint);
|
||||
n->contype = CONSTR_DEFAULT;
|
||||
n->location = @1;
|
||||
n->raw_expr = makeFloatConst($2, @2);
|
||||
n->cooked_expr = NULL;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| DEFAULT FCONST_D
|
||||
{
|
||||
Constraint *n = makeNode(Constraint);
|
||||
n->contype = CONSTR_DEFAULT;
|
||||
n->location = @1;
|
||||
n->raw_expr = makeFloatConst($2, @2);;
|
||||
n->cooked_expr = NULL;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| GENERATED ALWAYS AS '(' a_expr ')' STORED
|
||||
{
|
||||
#ifdef ENABLE_MULTIPLE_NODES
|
||||
|
||||
@ -950,5 +950,36 @@ create type binary_double_nan AS (
|
||||
);
|
||||
drop type binary_double_nan;
|
||||
set disable_keyword_options = '';
|
||||
set float_suffix_acceptance = on;
|
||||
CREATE TABLE employees (
|
||||
emp_id INT PRIMARY KEY,
|
||||
emp_name VARCHAR(100) NOT NULL,
|
||||
emp_salary DECIMAL(10, 2) DEFAULT 3.14f,
|
||||
hire_date DATE DEFAULT CURRENT_DATE
|
||||
);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "employees_pkey" for table "employees"
|
||||
INSERT INTO employees (emp_id, emp_name, hire_date) VALUES (1, 'John Doe', '2024-01-01');
|
||||
SELECT * FROM employees;
|
||||
emp_id | emp_name | emp_salary | hire_date
|
||||
--------+----------+------------+--------------------------
|
||||
1 | John Doe | 3.14 | Mon Jan 01 00:00:00 2024
|
||||
(1 row)
|
||||
|
||||
DROP TABLE employees;
|
||||
CREATE TABLE employees (
|
||||
emp_id INT PRIMARY KEY,
|
||||
emp_name VARCHAR(100) NOT NULL,
|
||||
emp_salary DECIMAL(10, 2) DEFAULT 3.14d,
|
||||
hire_date DATE DEFAULT CURRENT_DATE
|
||||
);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "employees_pkey" for table "employees"
|
||||
INSERT INTO employees (emp_id, emp_name, hire_date) VALUES (1, 'John Doe', '2024-01-01');
|
||||
SELECT * FROM employees;
|
||||
emp_id | emp_name | emp_salary | hire_date
|
||||
--------+----------+------------+--------------------------
|
||||
1 | John Doe | 3.14 | Mon Jan 01 00:00:00 2024
|
||||
(1 row)
|
||||
|
||||
DROP TABLE employees;
|
||||
drop schema if exists test_binary cascade;
|
||||
NOTICE: drop cascades to type "binary_double_infinity"
|
||||
|
||||
@ -362,4 +362,25 @@ create type binary_double_nan AS (
|
||||
drop type binary_double_nan;
|
||||
set disable_keyword_options = '';
|
||||
|
||||
set float_suffix_acceptance = on;
|
||||
CREATE TABLE employees (
|
||||
emp_id INT PRIMARY KEY,
|
||||
emp_name VARCHAR(100) NOT NULL,
|
||||
emp_salary DECIMAL(10, 2) DEFAULT 3.14f,
|
||||
hire_date DATE DEFAULT CURRENT_DATE
|
||||
);
|
||||
INSERT INTO employees (emp_id, emp_name, hire_date) VALUES (1, 'John Doe', '2024-01-01');
|
||||
SELECT * FROM employees;
|
||||
DROP TABLE employees;
|
||||
|
||||
CREATE TABLE employees (
|
||||
emp_id INT PRIMARY KEY,
|
||||
emp_name VARCHAR(100) NOT NULL,
|
||||
emp_salary DECIMAL(10, 2) DEFAULT 3.14d,
|
||||
hire_date DATE DEFAULT CURRENT_DATE
|
||||
);
|
||||
INSERT INTO employees (emp_id, emp_name, hire_date) VALUES (1, 'John Doe', '2024-01-01');
|
||||
SELECT * FROM employees;
|
||||
DROP TABLE employees;
|
||||
|
||||
drop schema if exists test_binary cascade;
|
||||
|
||||
Reference in New Issue
Block a user