Closed opsecx closed 7 months ago
Gonna try and POC this and make a PR if it works, if you don't mind
Put in a PR as above. Tested and works fine as best I can tell, but up to you guys if wanted solution. In any case there is an issue with any databases that have been updated the last two weeks with this..
Hey! So indeed I misread the postgres doc (https://www.postgresql.org/docs/current/sql-createview.html). We are using CREATE OR REPLACE VIEW
but there is is some conditions to it : but it may add additional columns to the end of the list.
and I have made the mistake to add it at the beginning...
I am going to approve your PR.
fixed in #182
As mentioned to Lola previously, an error might occur on changing the views, which is exactly what's happening now (preventing start).
Scenario:
Causes the following error: "Error: DB(Database(PgDatabaseError { severity: Error, code: "42P16", message: "cannot change name of view column \"address\" to \"txid\"", detail: None, hint: Some("Use ALTER VIEW ... RENAME COLUMN ... to change name of view column instead."), position: None, where: None, schema: None, table: None, column: None, data_type: None, constraint: None, file: Some("view.c"), line: Some(293), routine: Some("checkViewTupleDesc") }))"
Which prevents indexer from starting altogether.
Obviously this can be amended by dropping all views manually before starting indexer, but recommended fix in code by dropping or altering views appropriately, taking into account the possibility of former data structures in db. (feel free to reach out directly if the issue isn't clear)