Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Nifi putsql processor error: Due to org.postgresql.util.PSQLException: The column index is out of range: 1

Nifi putsql processor error: Due to org.postgresql.util.PSQLException: The column index is out of range: 1

New Contributor

I try convert ingect json file into postgresql for that first i try to convert my json file into sql format by using ConvertJSONToSQL processor, after that I pass flow into replacetext processor and after that I make flow into putsql processor. In putsql processor I got issue "Due to org.postgresql.util.PSQLException: The column index is out of range: 1"

NIFI Flow

17498-screenshot-from-2017-06-23-123451.png

PutSQL Error:

17494-screenshot-from-2017-06-23-122030.png

PutSQL processor configuration

17495-screenshot-from-2017-06-23-122040.png

ReplaceText processor configuration

17496-screenshot-from-2017-06-23-122100.png

Replacement Value: "INSERT INTO public.detail (id,name, salary) VALUES (${id},${name},${salary})"

ConvertJSONToSQL processor configuration

17497-screenshot-from-2017-06-23-122133.png

3 REPLIES 3

Re: Nifi putsql processor error: Due to org.postgresql.util.PSQLException: The column index is out of range: 1

We are getting same error, please post if you found any solution for this error.

Re: Nifi putsql processor error: Due to org.postgresql.util.PSQLException: The column index is out of range: 1

Super Collaborator

Hi @Narasimma varman,

Apparently this is the error form Postgres Driver, when I dig the reference for the error, got to know that when the mismatch of the column list or any issues with the sql is the possible root cause for the error.

however, when I look the sql I couldn't see the value for the Name is not quoted.( being the char column in SQL must be quoted).

any other column which is of char/date must be quoted in sql.

INSERT INTO public.detail (id,name, salary) VALUES (${id},'${name}',${salary})

On the other note, you could use convert json sql to --> put sql direct,

perhaps you may use json to Attribute --> Replace Text and then to --> putSQL. for the same thing if you wish to do it in different way.

Hope this helps !!

Re: Nifi putsql processor error: Due to org.postgresql.util.PSQLException: The column index is out of range: 1

Super Collaborator

and please ensure that, there are no columns in salary ( if it is defined as Decimal/integer in Database)

Don't have an account?
Coming from Hortonworks? Activate your account here