From c1e84352c0ed924926506df40f4ccfc140b8ccaf Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Tue, 1 Sep 2020 14:42:40 +0100
Subject: [PATCH] Issue #3154669 by longwave, jungle, mohrerao, jameszhang023,
 ravi.shankar, quietone: Fix or ignore 33 words only used in the PostgreSQL
 driver

---
 .../Core/Database/Driver/pgsql/Connection.php |  4 ++-
 .../Core/Database/Driver/pgsql/Insert.php     |  2 ++
 .../Core/Database/Driver/pgsql/Schema.php     | 13 ++++++--
 .../Core/Database/Driver/pgsql/Upsert.php     |  2 ++
 core/misc/cspell/dictionary.txt               | 33 -------------------
 .../Driver/pgsql/PostgresqlSchemaTest.php     |  2 ++
 6 files changed, 19 insertions(+), 37 deletions(-)

diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php
index 0ffafc9ee880..d0af84240454 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php
@@ -8,6 +8,8 @@
 use Drupal\Core\Database\DatabaseNotFoundException;
 use Drupal\Core\Database\StatementInterface;
 
+// cSpell:ignore ilike nextval
+
 /**
  * @addtogroup database
  * @{
@@ -258,7 +260,7 @@ public function mapConditionOperator($operator) {
   public function nextId($existing = 0) {
 
     // Retrieve the name of the sequence. This information cannot be cached
-    // because the prefix may change, for example, like it does in simpletests.
+    // because the prefix may change, for example, like it does in tests.
     $sequence_name = $this->makeSequenceName('sequences', 'value');
 
     // When PostgreSQL gets a value too small then it will lock the table,
diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php
index 2a7ef3686b53..5fc6a214c617 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php
@@ -5,6 +5,8 @@
 use Drupal\Core\Database\Database;
 use Drupal\Core\Database\Query\Insert as QueryInsert;
 
+// cSpell:ignore nextval setval
+
 /**
  * @ingroup database
  * @{
diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php
index 6cf476414d02..1e7c4b6dca7d 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php
@@ -6,6 +6,12 @@
 use Drupal\Core\Database\SchemaObjectDoesNotExistException;
 use Drupal\Core\Database\Schema as DatabaseSchema;
 
+// cSpell:ignore adbin adnum adrelid adsrc attisdropped attname attnum attrdef
+// cSpell:ignore attrelid atttypid atttypmod bigserial conkey conname conrelid
+// cSpell:ignore contype fillfactor indexname indexrelid indisprimary indkey
+// cSpell:ignore indrelid nextval nspname regclass relkind relname relnamespace
+// cSpell:ignore schemaname setval
+
 /**
  * @addtogroup schemaapi
  * @{
@@ -566,6 +572,7 @@ public function renameTable($table, $new_name) {
 
       // If the index is already rewritten by ensureIdentifiersLength() to not
       // exceed the 63 chars limit of PostgreSQL, we need to take care of that.
+      // cSpell:disable-next-line
       // Example (drupal_Gk7Su_T1jcBHVuvSPeP22_I3Ni4GrVEgTYlIYnBJkro_idx).
       if (strpos($index->indexname, 'drupal_') !== FALSE) {
         preg_match('/^drupal_(.*)_' . preg_quote($index_type) . '/', $index->indexname, $matches);
@@ -945,12 +952,12 @@ public function changeField($table, $field, $field_new, $spec, $new_keys = []) {
 
     if (isset($spec['not null'])) {
       if ($spec['not null']) {
-        $nullaction = 'SET NOT NULL';
+        $null_action = 'SET NOT NULL';
       }
       else {
-        $nullaction = 'DROP NOT NULL';
+        $null_action = 'DROP NOT NULL';
       }
-      $this->connection->query('ALTER TABLE {' . $table . '} ALTER "' . $field . '" ' . $nullaction);
+      $this->connection->query('ALTER TABLE {' . $table . '} ALTER "' . $field . '" ' . $null_action);
     }
 
     if (in_array($spec['pgsql_type'], ['serial', 'bigserial'])) {
diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Upsert.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Upsert.php
index a4c168005fce..df63e137847e 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Upsert.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Upsert.php
@@ -4,6 +4,8 @@
 
 use Drupal\Core\Database\Query\Upsert as QueryUpsert;
 
+// cSpell:ignore nextval setval
+
 /**
  * PostgreSQL implementation of \Drupal\Core\Database\Query\Upsert.
  */
diff --git a/core/misc/cspell/dictionary.txt b/core/misc/cspell/dictionary.txt
index e736c742192e..0c0c84bf967e 100644
--- a/core/misc/cspell/dictionary.txt
+++ b/core/misc/cspell/dictionary.txt
@@ -9,15 +9,11 @@ accesslog
 accum
 actionid
 adamson
-adbin
 addedline
 addtogroup
 admin's
 adminforms
 adminlabel
-adnum
-adrelid
-adsrc
 aewesome
 aflopend
 afterbegin
@@ -81,17 +77,10 @@ atomentry
 atomfeed
 atomrendererfeed
 atsign
-attisdropped
-attname
-attnum
-attrdef
-attrelid
 attributename
 attrlist
 attrval
 attrvals
-atttypid
-atttypmod
 auditable
 auth's
 authless
@@ -170,7 +159,6 @@ bgcolor
 bgred
 bgsound
 bigpipe
-bigserial
 bikeshed
 bikesheds
 bing
@@ -321,10 +309,7 @@ configurability
 configurator
 confirm's
 conformant
-conkey
-conname
 conneg
-conrelid
 contaynz
 contentblock
 contenteditable
@@ -335,7 +320,6 @@ contextuals
 contrained
 contribs
 controlgroup
-contype
 coord
 copmplete
 corefake
@@ -623,7 +607,6 @@ filestorage
 filesystems
 filetransfer
 filevalidationerror
-fillfactor
 filterprovider
 filtertypes
 findwith
@@ -788,17 +771,12 @@ iframe's
 iframes
 iframeupload
 ignoretag
-ilike
 imagecache
 imagecreatefrom
 imagefields
 imagetest
 inator
 indexname
-indexrelid
-indisprimary
-indkey
-indrelid
 ingoa
 inited
 inno
@@ -839,7 +817,6 @@ janvier
 javascripts
 jcbfyr
 jessebeach
-jkro
 jnoub
 johansson
 johndoe
@@ -1118,7 +1095,6 @@ newname
 newnode
 newstr
 newterm
-nextval
 nfocus
 nids
 nightlies
@@ -1180,13 +1156,11 @@ nplurals
 npoll
 nprofile
 nresponse
-nspname
 nstrings
 nsync
 ntaxonomy
 ntfs
 nturn
-nullaction
 nyan
 nyancat
 nyans
@@ -1423,7 +1397,6 @@ referencer
 referencers
 referer
 refinable
-regclass
 regexes
 rehydrated
 reimplement
@@ -1434,9 +1407,6 @@ reinitializes
 reinject
 reinstantiated
 reiss
-relkind
-relname
-relnamespace
 removeformat
 renderable
 renderables
@@ -1507,7 +1477,6 @@ scaffol
 scarlett
 schemaapi
 schemaless
-schemaname
 schemeless
 schipul
 schipulcon
@@ -1535,7 +1504,6 @@ serviceform
 sess
 sessionpath
 settingstray
-setval
 sharedspace
 shatner
 shorterthan
@@ -1549,7 +1517,6 @@ silverlight
 silvie
 simpletest
 simpletest's
-simpletests
 singlebyte
 sioc
 sioct
diff --git a/core/tests/Drupal/Tests/Core/Database/Driver/pgsql/PostgresqlSchemaTest.php b/core/tests/Drupal/Tests/Core/Database/Driver/pgsql/PostgresqlSchemaTest.php
index a9a4aeb7af22..48c835da0871 100644
--- a/core/tests/Drupal/Tests/Core/Database/Driver/pgsql/PostgresqlSchemaTest.php
+++ b/core/tests/Drupal/Tests/Core/Database/Driver/pgsql/PostgresqlSchemaTest.php
@@ -5,6 +5,8 @@
 use Drupal\Core\Database\Driver\pgsql\Schema;
 use Drupal\Tests\UnitTestCase;
 
+// cSpell:ignore conname
+
 /**
  * @coversDefaultClass \Drupal\Core\Database\Driver\pgsql\Schema
  * @group Database
-- 
GitLab