diff --git a/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php b/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php
index 05d675509b..1e6ae1fb55 100644
--- a/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php
+++ b/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php
@@ -158,7 +158,7 @@ public function query() {
     $join = Views::pluginManager('join')->createInstance($id, $def);
 
     // use a short alias for this:
-    $alias = $def['table'] . '_' . $this->table;
+    $alias = $this->shortenTableAlias($def['table']) . '_' . $this->table;
 
     $this->alias = $this->query->addRelationship($alias, $join, $this->definition['base'], $this->relationship);
 
@@ -180,6 +180,22 @@ public function calculateDependencies() {
     return $dependencies;
   }
 
+  /**
+   * Shorten table name to avoid pgsql error on long alias names
+   * @param string $table_name
+   *
+   * @return string
+   */
+  private function shortenTableAlias(string $table_name) {
+    $new_alias = '';
+    foreach (explode('_', $table_name) as $word) {
+      $new_alias .= $word[0];
+    }
+
+    return !empty($new_alias) ? $new_alias : $table_name;
+
+  }
+
 }
 
 /**
