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

Collision in field and table name causes issues #21

Closed
luza opened this issue Sep 10, 2019 · 3 comments
Closed

Collision in field and table name causes issues #21

luza opened this issue Sep 10, 2019 · 3 comments
Labels

Comments

@luza
Copy link
Contributor

luza commented Sep 10, 2019

Faced an error function row_to_json(integer) does not exist on loading fixture to the table, one column of which named the same as the table.

Happens because under the hood Gonkey constructs following query:

INSERT INTO "level" ("brand_id", "cashback_factor", "level") VALUES (6577, 0.05, 2) RETURNING row_to_json("level")

Possible solution is to stop using RETURNING row_to_json() in favour of RETURNING * and to scan result into the struct (adopt one of existing libraries for this job).

@luza luza added the fixtures label Sep 10, 2019
@fetinin
Copy link
Contributor

fetinin commented Sep 11, 2019

Would it help if we'll give a table some unique alias with AS?

@luza
Copy link
Contributor Author

luza commented Sep 11, 2019

Hm, good point. That might work too.

@fetinin
Copy link
Contributor

fetinin commented Sep 15, 2019

It did :)

@luza luza closed this as completed Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants