ERROR: relation "core.users" does not exist

Installation Forum (Inactive)
ERROR: relation "core.users" does not exist rob_ewing50  2009-02-13 15:25
Status: Closed
 
Hello:

I am having some major upgrade issues. I have attempted to upgrade from v8.1 to v8.3 unsuccessfully. Now I try to go back to v8.1, and I get the attached error regarding the core schema. I am assuming the schema is modified when first logging into new version, but this has left me with an apparently broken cpas instance with a lot of data, that is neither v8.1 or v8.3. Anyway I can rectify this?

I have checked the core schema in my database - and indeed there is no core.users table or view.

Alternatively, how would I migrate the data from v8.1 to a different postgres instance / v8.3?

Suggestions please.

Rob.
 
 
Matthew Bellew responded:  2009-02-13 16:02
Just to cover the obvious, I assume from this post you did not backup the database before trying the upgrade?

There is no automatic way to downgrade the database. The best thing to do when an upgrade fails is to restore a the database, understand and fix the error in the script or the DB and retry the upgrade. Fortunately, upgrades don't fail very often.

If you don't have a backup, the fix may involve going through the upgrade scripts one by one an applying them by hand. Someone else on the LabKey team may have more specific or useful advice.

Matt
 
Matthew Bellew responded:  2009-02-13 16:05
One more note before any panic sets in. core.users is just a view. It is very unlikely that any data was lost in this process. When an upgrade starts all views are dropped, and then recreated after all the scripts have run.

So core.users is not the big problem. The problem figuring out what state the real tables are in. Do you have the errors or logs from when the upgrade failed?

Matt
 
jeckels responded:  2009-02-13 16:16
Hi Rob,

As Matt said, hopefully you can continue the upgrade process and get to 8.3 - so far there's no sign that data has been lost.

I can imagine that you might get into this state if you, for example:

1. Stopped the server.
2. Update the files on disk.
3. Restarted the server.
4. Stopped the server after it had started the upgrade but before it finished.
5. Restarted the server and tried to resume the upgrade.

If something like that might have happened, these steps should be non-destructive and may fix the problem:

1. Shut down your LabKey Server instance.
2. Run this script manually against your database (it sounds like you've already logged in through a tool like PGAdmin):
https://hedgehog.fhcrc.org/tor/stedi/branches/release8.3/server/modules/core/src/META-INF/core/scripts/postgresql/core-create.sql
3. Restart your LabKey Server instance.
4. Try the upgrade again.

If anything goes wrong with this process, be sure to grab the log file, which should be in <TOMCAT_HOME>/logs/labkey.log.

Thanks,
Josh
 
jeckels responded:  2009-02-13 16:17
I should clarify that you should be running the 8.3 when running those steps.

Thanks,
Josh
 
rob_ewing50 responded:  2009-02-13 16:34
Thanks for quick response.

When I reinstall the v8.3 and restart the server - I get this:


500: Unexpected server error
A failure occurred during LabKey Server startup.

org.labkey.api.data.SqlScriptRunner$SqlScriptException: core-8.20-8.21.sql : ERROR: column "active" of relation "principals" already exists
       at org.labkey.api.data.SqlScriptManager.runScript(SqlScriptManager.java:144)
       at org.labkey.api.data.SqlScriptRunner$BackgroundScriptRunner.run(SqlScriptRunner.java:302)
Caused by: org.postgresql.util.PSQLException: ERROR: column "active" of relation "principals" already exists
       at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1592)
       at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1327)
       at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192)
       at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
       at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:336)
       at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:328)
       at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.execute(DelegatingStatement.java:261)
       at org.labkey.api.data.ConnectionWrapper$StatementWrapper.execute(ConnectionWrapper.java:1396)
       at org.labkey.api.data.Table.execute(Table.java:142)
       at org.labkey.api.data.Table.execute(Table.java:357)
       at org.labkey.api.data.SqlDialect.runSql(SqlDialect.java:488)
       at org.labkey.api.data.SqlScriptManager.runScript(SqlScriptManager.java:140)
       ... 1 more
 
rob_ewing50 responded:  2009-02-13 17:28
Thanks gents for your input - problem solved.

I used the core-create.sql and core-8.20-8.21.sql to refresh the users table and principals table and that seems to have done the trick.

Rob.