Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

error in jira query

Deleted user March 19, 2020

hello, I'm running this query

https://confluence.atlassian.com/jirakb/find-the-last-login-date-for-a-user-in-jira-server-363364638.html

the one for jira 7.0.x onwards (postgresql).

when I run the query I get
-------------------------------------------------------------------

psql:query.sql:16: ERROR: relation "cwd_user" does not exist
LINE 4: FROM cwd_user u
^
-------------------------------------------------------------------
I'm running it with this command.

psql --host=xxxxxxxxxx --port=5432 --username=user1 --password --dbname=db -f query.sql

Any ideas what could be the problem?

Thanks.

1 answer

1 accepted

0 votes
Answer accepted
Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 20, 2020

Hello @[deleted] ,

Thanks for reaching out and the formatting of your query is good and I just ran a test using the same syntax via the following exe using the top query from the document you listed as my test file and everything went through without error:

$ psql --host=localhost --port=5432 --username=test --dbname=jiradb -f sql_query.sql 


        Directory        | Username |       Last Login       
-------------------------+----------+------------------------
Jira Internal Directory | admin    | 2020-03-18 11:55:24-05
(1 row)

The error you are seeing is indicating the cwd_user table is not present in the database you're searching in.  I would recomend double checking the dbname variable in the query to make sure there are no typos, and that it lines up with the DB listed in the dbconfig.xml located at the root of your Jira home directory.

Regards,
Earl

Deleted user March 20, 2020

Yes the problem was that I was using the wrong database.
Thanks.

Like Earl McCutcheon likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events