Hello all,
Problem/Motivation
Drupal Version: 9.3.6
PHP Version: 8.1.3
Database: PostgreSQL
Database Version: 13.6
Development Environment: Docker 4 Drupal
I'm trying to create a view, using fields, one relationship with entity reference field between 2 content types and a contextual filter for content ID. When I try to provide the default value by content ID from URL, it works. Unfortunately, I have to provide default value as "raw value from URL" type. When I try to do it, I get the error message which I paste below:
SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type bigint: "structure" LINE 6: ... ((field_measuring_stations_node_field_data.nid = 'structure... ^: SELECT "node_field_data"."langcode" AS "node_field_data_langcode", "field_measuring_stations_node_field_data"."langcode" AS "field_measuring_stations_node_field_data_langcode", "node_field_data"."created" AS "node_field_data_created", "node_field_data"."nid" AS "nid", "field_measuring_stations_node_field_data"."nid" AS "field_measuring_stations_node_field_data_nid" FROM "node_field_data" "node_field_data" LEFT JOIN "node__field_measuring_stations" "node__field_measuring_stations" ON node_field_data.nid = node__field_measuring_stations.field_measuring_stations_target_id AND node__field_measuring_stations.deleted = :views_join_condition_0 LEFT JOIN "node_field_data" "field_measuring_stations_node_field_data" ON node__field_measuring_stations.entity_id = field_measuring_stations_node_field_data.nid WHERE ((field_measuring_stations_node_field_data.nid = :node_field_data_nid)) AND ("node_field_data"."type" IN (:db_condition_placeholder_1)) ORDER BY "node_field_data_created" DESC NULLS LAST LIMIT 5 OFFSET 0; Array ( [:node_field_data_nid] => structure [:db_condition_placeholder_1] => station [:views_join_condition_0] => 0 )
Steps to reproduce
The way to reproduce the error is:
- Install Drupal 9.3.6 with PHP 8.1.3 and PostgreSQL 13.6 (I'm going to paste docker-compose.yml and .env content as comments, if someone would like to use them).
- Create 2 different content types with entity reference one to another.
- Create a view with contextual filter, providing default value as "raw value from URL" type.
Proposed resolution
I've found
this issue β
, while searching a solution. It could be helpful for debugging.
Best,
Orkut