2

I have 2 tables and I try to get statuses from table status and add to each status info about an author from a user table. I created the same database on my laptop and everything works fine. But I've got an error when published the database on Heroku using ClearDB:

[42000][1305] FUNCTION heroku_1ecaeb2cbfaf113.JSON_OBJECT does not exist

Without JSON_OBJECT query works fine. What's going on? Where I made a mistake?

My tables:

CREATE TABLE IF NOT EXISTS user (
    login VARCHAR(15) NOT NULL PRIMARY KEY,
    name VARCHAR(15),
    avatar VARCHAR(150),
    ts INT,
    hash BINARY(60)
);

CREATE TABLE IF NOT EXISTS status (
    id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
    note VARCHAR(300),
    author VARCHAR(15),
  ts INT,
  replyTo INT UNSIGNED
);

My query:

SELECT
  status.id,
  status.note,
  status.ts,
  JSON_OBJECT(
    'login', statusAuthor.login,
    'name', statusAuthor.name
  )
FROM
  user,
  user statusAuthor
  INNER JOIN status ON statusAuthor.login = status.author
WHERE
  user.login = 'some_user' AND status.replyTo IS NULL
ORDER BY status.id
DESC
LIMIT 11;
rel1x
  • 2,351
  • 4
  • 34
  • 62

0 Answers0