fixed PostgreSQL tests

This commit is contained in:
2026-01-01 17:08:20 +01:00
parent 7cb64515bd
commit a79d50e6e8
17 changed files with 230 additions and 329 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ table_column alias(const std::string &column, const std::string &as) {
table_column alias(table_column &&col, const std::string &as) {
col.as(as);
return std::move(col);
return col;
}
table_column count(const std::string &column) {
+4 -3
View File
@@ -39,10 +39,10 @@ sql::query_context query_compiler::compile(const query_data &data,
std::string handle_column(sql::query_context &ctx, const sql::dialect *d, const query_data &data, const table_column &col) {
if (col.is_function()) {
ctx.prototype.emplace_back(col.has_alias() ? col.alias() : col.name());
ctx.prototype.emplace_back(col.has_alias() ? col.alias() : col.canonical_name());
ctx.prototype.back().change_type(utils::basic_type::Int32);
} else {
ctx.prototype.emplace_back(col.name());
ctx.prototype.emplace_back(col.canonical_name());
}
@@ -128,7 +128,8 @@ void query_compiler::visit(internal::query_drop_key_constraint_part_by_name& par
query_.sql += " " + dialect_->token_at(part.token()) + " " + part.name();
}
void query_compiler::visit(internal::query_drop_key_constraint_part_by_constraint& /*part*/) {
void query_compiler::visit(internal::query_drop_key_constraint_part_by_constraint& part) {
query_.sql += " " + build_drop_constraint_string(part.constraint());
}
void query_compiler::visit(internal::query_select_part &part) {
+10 -11
View File
@@ -56,12 +56,14 @@ table_column::table_column(const class table* tab,
std::string name,
std::string alias,
utils::basic_type type,
const utils::field_attributes &attributes)
const utils::field_attributes &attributes,
const sql::sql_function_t func)
: table_(tab)
, name_(std::move(name))
, alias_(std::move(alias))
, type_(type)
, attributes_(attributes) {}
, attributes_(attributes)
, function_(func) {}
table_column & table_column::operator=(const table_column &other) {
if (this == &other) {
@@ -72,17 +74,10 @@ table_column & table_column::operator=(const table_column &other) {
alias_ = other.alias_;
type_ = other.type_;
attributes_ = other.attributes_;
function_ = other.function_;
return *this;
}
table_column::table_column(const table_column &other)
: table_(other.table_)
, name_(other.name_)
, alias_(other.alias_)
, type_(other.type_)
, attributes_(other.attributes_) {
}
bool table_column::equals(const table_column &x) const {
if (table_ != nullptr && x.table_ != nullptr) {
return *table_ == *x.table_ &&
@@ -98,13 +93,17 @@ bool table_column::equals(const table_column &x) const {
table_column table_column::as(std::string a) {
alias_ = std::move(a);
return {table_, name_, alias_, type_, attributes_};
return {table_, name_, alias_, type_, attributes_, function_};
}
const std::string& table_column::name() const {
return name_;
}
std::string table_column::canonical_name() const {
return table_ ? table_->name() + "." + name_ : name_;
}
const std::string& table_column::alias() const {
return alias_;
}