Support Topics Documentation Slack YouTube Blog

Column specified twice

(Ralph R Njeim) #1

After migrating from 3.x to 4/5, I faced a lot of SQL issues. You had previously assisted me on fixing an error related to lost email templates.
In fact, I am currently unable to save data to one of my tables due to a duplicated column; the exception I am having is attached with the topic.
App ID: 709E3602-AABE-41E9-FF47-48B4C07F4700
Thank you in advance for you support!
Ralph :slight_smile:

(Vladimir Upirov) #2

Hi Ralph

I’ve created an internal ticket BKNDLSS-17427 for investigation the issue and we will notify you here about any progress

Thanks, Vlad

(Ralph R Njeim) #3

Thank you Vlad for your quick response!

(Sergey Kukurudzyak) #4

I can reproduce the issue if trying to execute next curl:

curl -X POST -H 'Content-Type:application/json' '<api-key>/data/Event' -d '{"Starttime" : 425245346, "starttime" : 425245346}'

or just send “starttime” in lower case

curl -X POST -H 'Content-Type:application/json' '<api-key>/data/Event' -d '{"starttime" : 425245346}'

but you have declared this column as “Starttime” so you have to change it in your code, or change the column name in the Backendless console

(Sergey Kukurudzyak) #5

Also I have found another issue with Ads table, if you use curl count works fine, but in the backendless console you receive Network Error. so I have created internal ticket for this issue BKNDLSS-17454

(Ralph R Njeim) #6

Hello Sergey,

thank you for your time and response!

During the migration I have not changed anything within my code that could lead to this blocking.
Regarding your answer, I can not modify anything on the server and affect negatively the other platforms. Therefore, I tried downloading the “CRUD generating code” and replace my “Event” object with the new one but nothing changed.

I do not see where I can modify the attribute in my code knowing that I have no “starttime” anywhere. (I performed a search on all the project).

Thank you again!

(Sergey Kukurudzyak) #7

There is a bug in the 3.x version that allows to use column names like “starttime” and “Starttime” in one request.

So you definitely have “starttime” in your code that is why you have this error

(Ralph R Njeim) #8

Hello again Sergey,
I do not have any “starttime” nor “endtime” in my code. Almost all attributes in my Event object start with a uppercase.

Looking at the sql error in the screenshot I have previously attached, you can see that all column names are lowercase while on the server they are in uppercase eg. “Verified” on the console and “verified” in the error stack.
Therefore, I deduce that only for Datetime data types this error occurs eg. “Starttime” and “Endtime” in my case. It is kind of risky to change anything on the console now, next week I should publish an update that will upgrade users from 3.x to 5.x
Event.txt (5.6 KB)

(Sergey Chupov) #9

Hi Ralph,
Can you please prepare a sample request your app is doing, so that we could run it as is and see the cause of the problem?

(Ralph R Njeim) #10

Hello Surgey,
Of course. I will attach the original .java of the upload activity along with a modified class where it uploads info automatically.
Please let me know if you need any additional info.

Thanks !
UploadEventsActivity.txt (54.9 KB)
UploadEventsActivity-SAMPLE.txt (4.1 KB)

(Sergey Kukurudzyak) #11

I can see next code event.setStarttime so Starttime wel be serialized as starttime be cause if standart java convension, unless you use data column name mapping

(Ralph R Njeim) #12

nothing worked, not even the name mapping. I am quite sure there is a bug related to DATETIME type but that’s ok, I have modified the string on my server and adapted the iOS and Android apps accordingly.

Thank you for your help!

(Sergey Kukurudzyak) #13

Attached simple example:

public class TestColumnName
  private Date TestColumn;

  @MapToProperty( property = "TestColumn" )
  public Date getTestColumn()
    return TestColumn;

  public TestColumnName setTestColumn( Date testColumn )
    TestColumn = testColumn;
    return this;

if you remove @MapToProperty( property = "TestColumn" ) then you will receive the same exception as you have in your code (1010.7 KB)