You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Quotes in column names seems to either be broken or not supported. I'm using an existing database and tables so I did not create the table though the interface
Steps to Reproduce the Problem
With the given table definition with quoted column
CREATE TABLE users (
id integer NOT NULL,
name text,
"admin" boolean DEFAULT false
);
And the following model details
type User struct {
ID int `json:"id" db:"id"`
Name string `json:"name" db:"name"`
Admin string `json:"admin" db:"admin"`
}
and alternatively with attempted quoted strings
type User struct {
ID int `json:"id" db:"id"`
Name string `json:"name" db:"name"`
Admin string `json:"admin" db:"\"admin\""`
}
Expected Behavior
I expected to get the json results pulling from the table which I do receive if I quote out the admin field in the struct. The issue only appears with columns with quoted names
Actual Behavior
For the first model I get the following sql statement showing in buffalo dev
SELECT admin_users.admin, admin_users.name, admin_users.id FROM admin.users AS admin_users
which fails in pgadmin because the quotes are missing.
and then the following error:
{
"error": "ERROR: column admin_users.admin does not exist (SQLSTATE 42703)"
}
With the alternative model the following sql statement is shown in buffalo dev
SELECT admin_users."admin", admin_users.name, admin_users.id FROM admin.users AS admin_users
which I can query successfully through pgadmin as the quotes are there.
But also generates the following error
{
"error": "missing destination name admin in *[]models.User"
}
I of course may be trying to handle the quotes incorrectly so any guidance would be greatly appreciated. I was unable to locate any mention of how to handle this in the documentation. I also was not able to find any one else reporting the issue here or on slack channel suggest in the support section of the documentation
Info
rhel8, Pop 5.3.2 version through Buffalo v0.16.23
The text was updated successfully, but these errors were encountered:
Description
Quotes in column names seems to either be broken or not supported. I'm using an existing database and tables so I did not create the table though the interface
Steps to Reproduce the Problem
With the given table definition with quoted column
And the following model details
and alternatively with attempted quoted strings
Expected Behavior
I expected to get the json results pulling from the table which I do receive if I quote out the admin field in the struct. The issue only appears with columns with quoted names
Actual Behavior
For the first model I get the following sql statement showing in buffalo dev
which fails in pgadmin because the quotes are missing.
and then the following error:
With the alternative model the following sql statement is shown in buffalo dev
which I can query successfully through pgadmin as the quotes are there.
But also generates the following error
I of course may be trying to handle the quotes incorrectly so any guidance would be greatly appreciated. I was unable to locate any mention of how to handle this in the documentation. I also was not able to find any one else reporting the issue here or on slack channel suggest in the support section of the documentation
Info
rhel8, Pop 5.3.2 version through Buffalo v0.16.23
The text was updated successfully, but these errors were encountered: