Splunk Search

How to query a field in DBXQuery that contains colon?

LearningGuy
Builder

Hello,
How to query a field in DBXQuery that contains colon?  
I ran the following query and got an error.  Thank you 
| dbxquery connection=visibility query="select abc:def from tableCompany"
org.postgresql.util.PSQLException: ERROR: syntax error at or near ":" Position:

I tried to put single quote
| dbxquery connection=visibility query="select 'abc:def' from tableCompany"
but it gave me the following result

?column?
abc:def
abc:def



Labels (2)
Tags (1)
0 Karma
1 Solution

etoombs
Path Finder

My bad. I didn't look to see what database you were using. You may need quotes around it = "abc:def". Since you're doing this inside a quoted string, you may need to escape them as \" in the string. 

View solution in original post

etoombs
Path Finder

My bad. I didn't look to see what database you were using. You may need quotes around it = "abc:def". Since you're doing this inside a quoted string, you may need to escape them as \" in the string. 

LearningGuy
Builder


Your suggestion worked. Thank you so much
| dbxquery connection=visibility query="select \"abc:def\" from tableCompany"

0 Karma

etoombs
Path Finder

Try brackets around the field name - [abc:def]

LearningGuy
Builder

Hello,
I put brackets around the field name [abc:def], but it still didn't work and got the following error
org.postgresql.util.PSQLException: ERROR: syntax error at or near "["

Thank you

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...