# Issues querying audit log

**URL:** <https://forum.inductiveautomation.com/t/issues-querying-audit-log/54734>\
**Category:** Ignition\
**Created:** [January 6, 2022, 3:30am UTC](https://forum.inductiveautomation.com/t/issues-querying-audit-log/54734 "2022-01-06T03:30:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rcarrilhof](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/rcarrilhof/32/22036_2.png) [@rcarrilhof](https://forum.inductiveautomation.com/u/rcarrilhof)\
**Post date:** [January 6, 2022, 3:30am UTC](https://forum.inductiveautomation.com/t/issues-querying-audit-log/54734/1 "2022-01-06T03:30:28Z")

</div>

Hi.

The solution is partially working for me, the basic goes quite well.

SELECT \* FROM audit\_events - is returning the expected result, but when I try to do any filter, E.g.

SELECT \* FROM audit\_events WHERE ACTOR = “RCF” - it returns  
an error saying that the column does not exist. I tried a few different options, but if I reference any column it returns the same error.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/f/9fef8ffda64bd05f1c46b38885b64dffd8211d52.png)

I also tried to do something similar with other tables, all work great, but it seems that the audit\_events table has something wrong in it and I can’t reference any column.

Any idea?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 6, 2022, 1:41pm UTC](https://forum.inductiveautomation.com/t/issues-querying-audit-log/54734/2 "2022-01-06T13:41:22Z")

</div>

This should have been a new topic. Don’t be a necromancer!

That said, I suspect the table has mixed or upper case names. PostgreSQL is case sensitive, and any unquoted identifiers are treated as lower case. (BTW, double quotes for identifiers, single quotes for values.)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 6, 2022, 4:55pm UTC](https://forum.inductiveautomation.com/t/issues-querying-audit-log/54734/3 "2022-01-06T16:55:47Z")

</div>

I believe auditing is the last Ignition table that’s generated uppercase, unfortunately. Which bears out Phil’s suggestion.

---

<div class="post-metadata">

**Author:** ![rcarrilhof](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/rcarrilhof/32/22036_2.png) [@rcarrilhof](https://forum.inductiveautomation.com/u/rcarrilhof)\
**Post date:** [January 6, 2022, 10:11pm UTC](https://forum.inductiveautomation.com/t/issues-querying-audit-log/54734/4 "2022-01-06T22:11:16Z")

</div>

Hi. thank you for the tip about the new topic!

Unfortunately, I tried the single quote, double quote, lower case, upper case, lighting candles, and some garlic too 🙂

I tried using the Query Builder as well, it all works fantastic with all other tables, but I can’t make any reference to columns in the audit\_events table.

This is a very simple query, created by the Query Builder, it is returning the same error.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/a/5ad14e4e7bb2c6acdf9e698352d172265d111221.png)

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/5/8540f019911b2f42e8ca22f32143e3b5fadbf9b2.png)

The simple SELECT \* FROM audit\_events works

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/c/3c56b42e01e1b9f2573ca470025924d67d9ece12.png)

The application is complex and there is some good level of SQL queries running alarm filters from multiple tables. This one was supposed to be the simplest query I have in the application.

Is there something wrong with the audit table?  
I am using version 8.0.17 by the way.

Thank you very much!

---

<div class="post-metadata">

**Author:** ![rcarrilhof](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/rcarrilhof/32/22036_2.png) [@rcarrilhof](https://forum.inductiveautomation.com/u/rcarrilhof)\
**Post date:** [January 6, 2022, 10:18pm UTC](https://forum.inductiveautomation.com/t/issues-querying-audit-log/54734/5 "2022-01-06T22:18:33Z")

</div>

Hi.

Thank you!

Interesting that the error message is always coming lower case regardless of how I write the query

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/5/d5590de332adf75c41294c951baa232093a6c1bf.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 6, 2022, 10:21pm UTC](https://forum.inductiveautomation.com/t/issues-querying-audit-log/54734/6 "2022-01-06T22:21:35Z")

</div>

Show your actual query.

---

<div class="post-metadata">

**Author:** ![rcarrilhof](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/rcarrilhof/32/22036_2.png) [@rcarrilhof](https://forum.inductiveautomation.com/u/rcarrilhof)\
**Post date:** [January 6, 2022, 10:27pm UTC](https://forum.inductiveautomation.com/t/issues-querying-audit-log/54734/7 "2022-01-06T22:27:49Z")

</div>

Hi Phil.

I was using the power table for Audit, now I have the need to bring the ACTOR\_HOST, so I started writing something from scratch and got stuck in the first attempt to reference any column.

So, my query now is these 3 lines 😀

Anyway, you guys figured it out!!!  
The problem was the actor being read as lower case even though I was writing upper case. Adding double quotes to the column name did the trick.

This query here works:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/a/cab04e567535a752952ca2191bb6754e1a82d4bf.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 6, 2022, 10:35pm UTC](https://forum.inductiveautomation.com/t/issues-querying-audit-log/54734/8 "2022-01-06T22:35:42Z")

</div>

> [@pturmel](#):
>
> PostgreSQL is case sensitive, and any unquoted identifiers are treated as lower case.

Hmm.
