Skip to content
New issue

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

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

Already on GitHub? # to your account

Specify columns explictly when inserting into API tables #179

Merged
merged 1 commit into from
May 25, 2019

Conversation

tomhughes
Copy link
Contributor

If you don't name the columns explicitly then you are depending on the order of the columns in the database which may vary if the history of the database and how it was updated doesn't match the one you are developing against.

If you don't name the columns explicitly then you are depending
on the order of the columns in the database which may vary if the
history of the database and how it was updated doesn't match the
one you are developing against.
FROM current_relations
WHERE id = ANY($1))
INSERT INTO relations (relation_id, changeset_id, timestamp, version, visible)
SELECT id AS relation_id, changeset_id, timestamp, version, visible
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the current_relations_to_history query below, we use an alias as an SELECT id AS relation_id, whereas current_nodes_to_history and current_ways_to_history don't use an alias SELECT id,.

It doesn't really make a difference here, it's just something I noticed while looking through the changes.

@mmd-osm mmd-osm merged commit e1506b2 into zerebubuth:master May 25, 2019
@tomhughes tomhughes deleted the columns branch May 25, 2019 23:02
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants