Editor-Node Has Incorrect pg references

Editor-Node Has Incorrect pg references

aschuettaschuett Posts: 3Questions: 2Answers: 0
edited July 2020 in Bug reports

Link to test case:
n/a - internal page

Debugger code (debug.datatables.net):
n/a - this is a server-side error, not client-side.

Error messages shown:
(node:42936) error: select count("id") as "cnt" from "auditEvents" where ("objectType" like $1 or "actionName" like $2 or "actionError" like $3 or "description" like $4 or "created_at" like $5) - operator does not exist: timestamp with time zone ~~ unknown

Description of problem:
DataTables/Editor-Node seems to be unable to search some column types when using a pg database. It appears the module has a workaround for pg databases to use ILIKE and to cast columns to text, but does not seem to be working. This feature is only enabled when the Knex client's config specifies a client of "psql", which to my knowledge is invalid. While I may be missing something, I believe the two entries noted below should be changed from "psql" to "pg".

Additionally, the type casting is invalid as-is and produces a query like:

select count("id") as "cnt" from "auditEvents" where ("objectType::text" ilike $1 or "actionName::text" ilike $2 or "actionError::text" ilike $3 or "description::text" ilike $4 or "created_at::text" ilike $5)

Knex doesn't appear to have any standardized type casting at this time, thus we should be using whereRaw/orWhereRaw:

I've submitted a PR for this -- see https://github.com/DataTables/Editor-Node/pull/9

Answers

  • allanallan Posts: 63,602Questions: 1Answers: 10,486 Site admin

    Fantastic - thanks for the PR. I've replied back there.

    Allan

This discussion has been closed.