Skip to content

catch error: error: select distinct on ("treetracker"."grower_account"."id") #364

@SuspenseFallback

Description

@SuspenseFallback

Server Log:

{
  method: 'select',
  options: {},
  timeout: false,
  cancelOnTimeout: false,
  bindings: [
    'deleted',
    'db741b6d-a8a7-47eb-87f0-976240ee2957,8b353fbe-0ad7-46a6-ad43-27e304a95757,ce14d9b7-92c3-450b-9779-2bb731c5aefc,40711d01-d4ee-4b60-99f9-6b5ad11d5e52',
    24
  ],
  __knexQueryUid: '4dLxnIGNpwk2LJZunOnXV',
  sql: 'select distinct on ("treetracker"."grower_account"."id") \n' +
    '        treetracker.grower_account.*,\n' +
    '        s.org_name as organization,\n' +
    '        d.device_configurations as devices,\n' +
    '        r.regions AS regions,\n' +
    '        COALESCE(c.captures_count, 0) AS captures\n' +
    '        FROM treetracker.grower_account\n' +
    '        LEFT JOIN treetracker.capture AS tc\n' +
    '          ON treetracker.grower_account.id = tc.grower_account_id\n' +
    '        LEFT JOIN field_data.device_configuration\n' +
    '          ON field_data.device_configuration.id = tc.device_configuration_id\n' +
    '        LEFT JOIN (\n' +
    '          SELECT tc.grower_account_id, ARRAY_AGG(DISTINCT(r.name)) AS regions\n' +
    '          FROM treetracker.capture AS tc\n' +
    '          JOIN regions.region AS r\n' +
    '            ON ST_WITHIN(tc.estimated_geometric_location, r.shape)\n' +
    '          GROUP BY tc.grower_account_id\n' +
    '          ) r ON treetracker.grower_account.id = tc.grower_account_id\n' +
    '        LEFT JOIN stakeholder.stakeholder AS s\n' +
    '          ON s.id = treetracker.grower_account.organization_id\n' +
    '        LEFT JOIN messaging.author AS author\n' +
    '          ON author.handle = treetracker.grower_account.wallet\n' +
    '        LEFT JOIN (\n' +
    '          SELECT grower_account_id, COUNT(*) AS captures_count\n' +
    '          FROM treetracker.capture\n' +
    '          GROUP BY grower_account_id\n' +
    '        ) c ON treetracker.grower_account.id = c.grower_account_id\n' +
    '        LEFT JOIN (\n' +
    '          SELECT tc.grower_account_id, ARRAY_AGG(row_to_json(dc.*)) AS device_configurations\n' +
    '          FROM treetracker.capture AS tc\n' +
    '          JOIN field_data.device_configuration AS dc\n' +
    '            ON dc.id = tc.device_configuration_id\n' +
    '          GROUP BY tc.grower_account_id\n' +
    '        ) d ON treetracker.grower_account.id = tc.grower_account_id\n' +
    '     where (not "treetracker"."grower_account"."status" = ? and "treetracker"."grower_account"."organization_id" = ?) limit ?'
}
catch error: error: select distinct on ("treetracker"."grower_account"."id") 
        treetracker.grower_account.*,
        s.org_name as organization,
        d.device_configurations as devices,
        r.regions AS regions,
        COALESCE(c.captures_count, 0) AS captures
        FROM treetracker.grower_account
        LEFT JOIN treetracker.capture AS tc
          ON treetracker.grower_account.id = tc.grower_account_id
        LEFT JOIN field_data.device_configuration
          ON field_data.device_configuration.id = tc.device_configuration_id
        LEFT JOIN (
          SELECT tc.grower_account_id, ARRAY_AGG(DISTINCT(r.name)) AS regions
          FROM treetracker.capture AS tc
          JOIN regions.region AS r
            ON ST_WITHIN(tc.estimated_geometric_location, r.shape)
          GROUP BY tc.grower_account_id
          ) r ON treetracker.grower_account.id = tc.grower_account_id
        LEFT JOIN stakeholder.stakeholder AS s
          ON s.id = treetracker.grower_account.organization_id
        LEFT JOIN messaging.author AS author
          ON author.handle = treetracker.grower_account.wallet
        LEFT JOIN (
          SELECT grower_account_id, COUNT(*) AS captures_count
          FROM treetracker.capture
          GROUP BY grower_account_id
        ) c ON treetracker.grower_account.id = c.grower_account_id
        LEFT JOIN (
          SELECT tc.grower_account_id, ARRAY_AGG(row_to_json(dc.*)) AS device_configurations
          FROM treetracker.capture AS tc
          JOIN field_data.device_configuration AS dc
            ON dc.id = tc.device_configuration_id
          GROUP BY tc.grower_account_id
        ) d ON treetracker.grower_account.id = tc.grower_account_id
     where (not "treetracker"."grower_account"."status" = $1 and "treetracker"."grower_account"."organization_id" = $2) limit $3 - invalid input syntax for type uuid: "db741b6d-a8a7-47eb-87f0-976240ee2957,8b353fbe-0ad7-46a6-ad43-27e304a95757,ce14d9b7-92c3-450b-9779-2bb731c5aefc,40711d01-d4ee-4b60-99f9-6b5ad11d5e52"
    at Parser.parseErrorMessage (/Users/krithinpakshootra/Documents/Projects/Greenstand/treetracker-query-api/node_modules/pg-protocol/src/parser.ts:369:69)
    at Parser.handlePacket (/Users/krithinpakshootra/Documents/Projects/Greenstand/treetracker-query-api/node_modules/pg-protocol/src/parser.ts:188:21)
    at Parser.parse (/Users/krithinpakshootra/Documents/Projects/Greenstand/treetracker-query-api/node_modules/pg-protocol/src/parser.ts:103:30)
    at TLSSocket.<anonymous> (/Users/krithinpakshootra/Documents/Projects/Greenstand/treetracker-query-api/node_modules/pg-protocol/src/index.ts:7:48)
    at TLSSocket.emit (node:events:517:28)
    at TLSSocket.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:335:12)
    at readableAddChunk (node:internal/streams/readable:308:9)
    at TLSSocket.Readable.push (node:internal/streams/readable:245:10)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
  length: 242,
  severity: 'ERROR',
  code: '22P02',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'uuid.c',
  line: '134',
  routine: 'string_to_uuid'
}
API took: /v2/growers?organization_id=%5B%22db741b6d-a8a7-47eb-87f0-976240ee2957%22%2C%228b353fbe-0ad7-46a6-ad43-27e304a95757%22%2C%22ce14d9b7-92c3-450b-9779-2bb731c5aefc%22%2C%2240711d01-d4ee-4b60-99f9-6b5ad11d5e52%22%5D&limit=24 1548.4067909999999

At ./server/infra/database/GrowerAccountRepository.ts, function getByFilter(), lines 281-333

Some hints:

  • Please read our readme for more information/guide/tutorial.
  • Here is an engineering book in Greenstand.
  • To know more about our organization, visit our website.
  • If you want to join the slack community (some resources need the community member's permission), please leave your email address.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions