As the title says, I'd like to create a view from a join between tables which have columns with identical names (surprisingly "id
").
Postgres doesn't prepend the table name to the result, but for some reason the query works fine, returning multiple columns with the same name and different data.
CREATE TABLE
is less forgiving, though, and returns:
ERROR: column "id" specified more than once
Others have suggested SELECT
ing the columns under a different name (e.g. here), but there are many columns to both tables.
Do I need to somehow automatically rename / remove the id
columns (such as this way), or is there a better way?