Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Update on object (empty column names): models: unable to update <table> row: pq: zero-length delimited identifier at or near """" #1275

Open
simon-connektica opened this issue May 23, 2023 · 1 comment

Comments

@simon-connektica
Copy link

I have a runtime error with an Update call, there are extra empty column names in the query which leads to a PG error:

models: unable to update station row: pq: zero-length delimited identifier at or near """"

What version of SQLBoiler are you using (sqlboiler --version)?

v4.12.2

What is your database and version (eg. Postgresql 10)

Postgres 15

If this happened at runtime what code produced the issue? (if not applicable leave blank)

m, err := models.Stations(models.StationWhere.ID.EQ(req.Id)).One(ctx, db)
if err != nil {
	return nil, err
}

m.Name = req.Name
m.Description = req.Description
m.Queue = req.Queue

rowsAff, err := m.Update(ctx, db, boil.Greylist(models.StationColumns.Name, models.StationColumns.Description, models.StationColumns.Queue))
if err != nil {
	return nil, err
}

What is the output of the command above with the -d flag added to it? (Provided you are comfortable sharing this, it contains a blueprint of your schema)

UPDATE "station" SET "name"=$1,"title"=$2,"description"=$3,"queue"=$4,"create_time"=$5,"update_time"=$6,""=$7,""=$8,""=$9 WHERE "id"=$10
[NewName StationTitle NewDescription NewQueue 2023-05-23 21:07:07.066346 +0000 +0000 2023-05-23 21:07:07.066346 +0000 +0000 0xc000430950 0xc000430960 0xc000430970 acdfb748-aee1-420e-9892-1ace318cc984]

I'm not sure what's going here, there are empty columns being added to the update.

Please provide a relevant database schema so we can replicate your issue (Provided you are comfortable sharing this)

CREATE TABLE station (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    name TEXT NOT NULL,
    title TEXT NOT NULL,
    description TEXT NOT NULL,
    queue TEXT NOT NULL,
    create_time TIMESTAMP NOT NULL DEFAULT NOW(),
    update_time TIMESTAMP NOT NULL DEFAULT NOW(),
    UNIQUE (name)
);

Further information. What did you do, what did you expect?

It should update the row without having empty columns.

@simon-connektica
Copy link
Author

There's no issue if I use boil.Infer() instead of boil.Greylist. Did I misunderstand how to use the Greylist with update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant