Status field couldnt fetch - sphinx

Using SphinxQl, I could not fetch status fields from particular index. If I try to fetch the status fields, I will get following errors. Please any one help to solve that issue?
Example:
Select Status from tablename;
I got following error:
syntax error, unexpected STATUS, expecting IDENT (or 17 other tokens) near 'Status from tablename'.
Note:
I could not insert any value at STATUS field in any index.

STATUS is a reserved word , use `status`

Related

SQLInjection how i can inject this target

my target is: target.com/n=2&b=exam&c=ABC' (Inject Here)
so then i put ' in URL's end i see this error:
Error accrues:
SQL Query: SELECT Level, Code, Name FROM `tbl_field` WHERE Level<3 ORDER BY Code ASC ORDER BY Year DESC LIMIT 0 , 10
Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY Year DESC LIMIT 0 , 10' at line 1
Code: 42000
File: /var/www/vhosts/target.com/httpdocs/db/db.php
Line: 98
now help me
i can not inject its... i try with sql but not working...
i know first must my query be balance.. but i can't... help me

Data value has invalid format error

I'm trying to run a query that includes only the past 90 days worth of data, but the query is returning the error "Data value...has invalid format".
The query is:
select name, diff
from
(select name, (getdate()::date - to_date(split_part(name, ' ', 1),'MM/DD/YYYY')::date) as diff
from sample_table)
where diff<=90;
The strange part is that the operation getdate()::date - to_date(split_part(name, ' ', 1),'MM/DD/YYYY')::date works as expected, but when restricted to <=90, it returns this error.
Any help is appreciated!
Find the bad row using the following code:
select split_part(name,' ',1) original_value, name
from sample_table
where split_part(name,'1') !~ '^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[1,3-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$'
This uses regex to determine if there's a valid date in that part of the field-- if not, it returns the field so you may find it.

Nxlog im_dbi is not working

I am able to insert data into PostgreSQL using nxlog(om_dbi).
But I am not able to select data(or fetch data) from PostgreSQL using nxlog. I tried many options nothing is working.
And in nxlog document also for IM_DBI module description has only "FIXME" mentioned.
Document Link: http://nxlog.org/documentation/nxlog-community-edition-reference-manual-v20928#im_dbi
Please help me to solve this.
Logs:
<Input dbiin>
Module im_dbi
SavePos TRUE
SQL SELECT * FROM NEW_TABLE
Driver pgsql
Option host 127.0.0.1
Option username chitta
Option password ''
Option dbname db
</Input>
2014-10-16 14:29:17 WARNING nxlog-ce received a termination request signal, exiting...
2014-10-16 14:29:18 INFO nxlog-ce-2.8.1248 started
2014-10-16 14:29:18 ERROR im_dbi failed to execute SQL statement. ERROR: column "id" does not exist;LINE 1: SELECT * FROM NEW_TABLE WHERE id = 1;
Note:
the module will automatically prepends a "WHERE id > %d" clause.
Not an answer, but here's some help.
The most important directive is missing: SQL Select ID as id,
DateOccured as EventTime, data from logtable
Source: https://www.mail-archive.com/nxlog-ce-users#lists.sourceforge.net/msg00225.html
I'm currently in the same boat. My assumption is that your data is not formatted in a way that nxlog can interpret. Troubleshooting and will get back to you if I can find a resolution.
Also digging through the source code for the im_dbi module.
https://github.com/lamby/pkg-nxlog-ce/blob/master/src/modules/input/dbi/im_dbi.c
The answer by SoMuchToGrok is valid.
Actually the question already has this: "ERROR: column "id" does not exist".
The table must have an id column or you must use SELECT x as id so that the result set has id in it

"No current record for fetch operation" for select insert

Can anyone see why I'm getting the "No current record for fetch operation" below?
I'm successfully skipping duplicate records by catching and not re-throwing the unique key violation exception below. There is another error however.
FOR SELECT
...
FROM
P_SELECT_CLAIM_FILE cf
ORDER BY
cf.DATESBM, cf.TIMESBM, cf.TRANSCDE
INTO
...variables
DO BEGIN
INSERT INTO
CLAIM_TABLE (...)
VALUES (...variables);
WHEN GDSCODE unique_key_violation DO
TX_ID=0;
WHEN GDSCODE no_cur_rec DO
/* Why does this happen?
-508 335544348 no_cur_rec No current record for fetch operation
*/
EXCEPTION E 'no_cur_rec ' || TX_ID;
END
The procedure P_SELECT_CLAIM_FILE contains another FOR SELECT INTO with lots of trimming and finally a SUSPEND command. This reads from a fixed width text file.
I'm tempted to change this into a single INSERT SELECT where not exists statement. I prefer to make a minimal fix instead however; the holidays already here.

postgresql INSERT ... RETURNING query keeps failing?

The error message is kinda vague... The query below works on one server, but fails on another:
INSERT INTO searches (status, uid, datecreated, searchname, options)
VALUES (0, 1, NOW(), 'TEST', '16') RETURNING sid;
And I get this error:
Query failed: ERROR: syntax error at or near "RETURNING"
Am I missing something here?
Query certainly looks right - assuming the field sid does exist (I take it it's a SERIAL field).
Are you sure you're using a PostgreSQL version that has support for RETURNING? You need version 8.2 or newer for this.