$tableName is used by constraint keys.
343109
protected function loadFromCache($schema, $itemType, $itemName, $tableName = null)
    {
        if ($tableName) {
            if (isset($this->constraintKeys[$schema][$tableName][$itemName])) {
                return;
            }
        } else {
            $prop = $this->keyToProperty($itemType);
            if (isset($this->{$prop}[$schema][$itemName])) {
                return;
            }
        }
        
        $key  = $this->cacheKey($schema . '.' . $itemType . '.' . $itemName);
        $data = $this->cache()->read($key);
        
        if (!$data) {
            $this->loadAndCache($schema, $itemType, $itemName, $key, $tableName);
        } else {
            switch ($itemType) {
                case 'tb':
                    $object = new ZfObject\TableObject($data['name']);
                    $this->setTableData($object, $data);
                    break;
                
                case 'vw':
                    $object = new ZfObject\ViewObject($data['name']);
                    $object->setViewDefinition($data['viewDefinition']);
                    $object->setCheckOption($data['checkPption']);
                    $object->setIsUpdatable($data['isUpdatable']);
                    $this->setTableData($object, $data);
                    break;
                
                case 'ck':
                    $object = new ZfObject\TriggerObject();
                    $object->setOrdinalPosition($data['ordinalPosition']);
                    $object->setReferencedTableSchema($data['referencedTableSchema']);
                    $object->setForeignKeyUpdateRule($data['updateRule']);
                    $object->setForeignKeyDeleteRule($data['deleteRule']);
                    $object->setReferencedTableName($data['referencedTableName']);
                    $object->setReferencedColumnName($data['referencedColumnName']);
                    break;
                
                case 'tr':
                    $object = new ZfObject\ConstraintKeyObject();
                    $object->setName($data['name']);
                    $object->setEventManipulation($data['eventManipulation']);
                    $object->setEventObjectCatalog($data['eventObjectCatalog']);
                    $object->setEventObjectSchema($data['eventObjectSchema']);
                    $object->setEventObjectTable($data['eventObjectTable']);
                    $object->setActionOrder($data['actionOrder']);
                    $object->setActionCondition($data['actionCondition']);
                    $object->setActionStatement($data['actionStatement']);
                    $object->setActionOrientation($data['actionOrientation']);
                    $object->setActionTiming($data['actionTiming']);
                    $object->setActionReferenceOldTable($data['actionReferenceOldTable']);
                    $object->setActionReferenceNewTable($data['actionReferenceNewTable']);
                    $object->setActionReferenceOldRow($data['actionReferenceOldRow']);
                    $object->setActionReferenceNewRow($data['actionReferenceNewRow']);
                    $object->setCreated($data['created']);
                    break;
            }
            
            $this->setItem($object, $schema, $itemType, $itemName, $tableName);
        }
    }
467804
public static function tableForeignKeys($tableName)
    {
        $result = ['inner' => [], 'outer' => []];
        foreach (Yii::$app->db->schema->tableSchemas as $table) {
            $foreignKeys = static::findConstraints($table);
            /** @var TableSchema $table */
            if ($table->name == $tableName) {
                $result['inner'] = $foreignKeys;
                continue;
            }
            foreach ($foreignKeys as $foreignKey) {
                if ($foreignKey['ftable'] == $tableName) {
                    $result['outer'][] = $foreignKey;
                }
            }
        }
        return $result;
    }
132760
public function findForeignKeys ($table, $column = null)
		{
			$query = ( new  Query )
				->select('CONSTRAINT_NAME')
				->from('INFORMATION_SCHEMA.KEY_COLUMN_USAGE')
				->where([
					'TABLE_SCHEMA' => $this->getDbName(),
					'TABLE_NAME'   => $table
				]);
			if (!is_null($column))
				$query->andWhere([ 'COLUMN_NAME' => $column ]);

			return $query->column();
		}
1088141
private Optional<String> tryGetEntityTypeName(String tableName) {
    EntityTypeDescription entityTypeDescription =
        entityTypeRegistry.getEntityTypeDescription(tableName);
    String entityTypeId = entityTypeDescription != null ? entityTypeDescription.getId() : null;
    return Optional.ofNullable(entityTypeId);
  }
30242
public function getTableKeys($tableName) {
		
		$keys = array();
		
		$fields = $this->describeTable($tableName);
		
		foreach ($fields as $field) {
			if ('PRI' == $field->Key) {
				$keys[] = $field->Field;
			}
		}
		
		return $keys;
		
	}
116769
function ___table($tableName) {
        $this->name = $tableName;
        $this->table = $this->prefix.$tableName;
        return $this;
    }
113408
def get_constraints(self, cursor, table_name):
        
        constraints = {}
        # Loop over the key table, collecting things as constraints
        # This will get PKs, FKs, and uniques, but not CHECK
        cursor.execute("""
            SELECT
                kc.constraint_name,
                kc.column_name,
                c.constraint_type,
                array(SELECT table_name::text || '.' || column_name::text
                      FROM information_schema.constraint_column_usage
                      WHERE constraint_name = kc.constraint_name
                        AND constraint_schema = kc.constraint_schema)
            FROM information_schema.key_column_usage AS kc
            JOIN information_schema.table_constraints AS c ON
                kc.table_schema = c.table_schema AND
                kc.table_name = c.table_name AND
                kc.constraint_name = c.constraint_name
            WHERE
                kc.table_schema = %s AND
                kc.table_name = %s
            ORDER BY kc.ordinal_position ASC
        """, [self.connection.schema, table_name])
        for constraint, column, kind, used_cols in cursor.fetchall():
            # If we're the first column, make the record
            if constraint not in constraints:
                constraints[constraint] = {
                    "columns": [],
                    "primary_key": kind.lower() == "primary key",
                    "unique": kind.lower() in ["primary key", "unique"],
                    "foreign_key": tuple(used_cols[0].split(".", 1)) if kind.lower() == "foreign key" else None,
                    "check": False,
                    "index": False,
                }
            # Record the details
            constraints[constraint]['columns'].append(column)
        # Now get CHECK constraint columns
        cursor.execute("""
            SELECT kc.constraint_name, kc.column_name
            FROM information_schema.constraint_column_usage AS kc
            JOIN information_schema.table_constraints AS c ON
                kc.table_schema = c.table_schema AND
                kc.table_name = c.table_name AND
                kc.constraint_name = c.constraint_name
            WHERE
                c.constraint_type = 'CHECK' AND
                kc.table_schema = %s AND
                kc.table_name = %s
        """, [self.connection.schema, table_name])
        for constraint, column in cursor.fetchall():
            # If we're the first column, make the record
            if constraint not in constraints:
                constraints[constraint] = {
                    "columns": [],
                    "primary_key": False,
                    "unique": False,
                    "foreign_key": None,
                    "check": True,
                    "index": False,
                }
            # Record the details
            constraints[constraint]['columns'].append(column)
        # Now get indexes
        cursor.execute("""
            SELECT
                c2.relname,
                ARRAY(
                    SELECT (SELECT attname FROM pg_catalog.pg_attribute WHERE attnum = i AND attrelid = c.oid)
                    FROM unnest(idx.indkey) i
                ),
                idx.indisunique,
                idx.indisprimary
            FROM pg_catalog.pg_class c, pg_catalog.pg_class c2,
                pg_catalog.pg_index idx, pg_catalog.pg_namespace n
            WHERE c.oid = idx.indrelid
                AND idx.indexrelid = c2.oid
                AND c.relnamespace = n.oid
                AND n.nspname = %s
                AND c.relname = %s
        """, [self.connection.schema, table_name])
        for index, columns, unique, primary in cursor.fetchall():
            if index not in constraints:
                constraints[index] = {
                    "columns": list(columns),
                    "primary_key": primary,
                    "unique": unique,
                    "foreign_key": None,
                    "check": False,
                    "index": True,
                }
        return constraints
833618
@Override
	public String onColumnFullyQualifiedName(String tableName, String columnName) {
		if (onlyBindParameter)
			return null;

		return JQLReplacerListenerImpl.resolveFullyQualifiedColumnName(currentSchema, currentMethod, tableName, columnName);
	}
285147
protected function generateDropIndexSql( $tableName, $indexName )
    {
        if ( $indexName == 'primary' ) // handling primary indexes
        {
            $constraintName = ezcDbSchemaOracleHelper::generateSuffixedIdentName( array( $tableName ), "pkey");
            $this->queries[] = "ALTER TABLE \"$tableName\" DROP CONSTRAINT \"{$constraintName}\"";
        }
        else
        {
            $this->queries[] = "DROP INDEX \"$indexName\"";
        }
    }
1259824
public List<DataColumnConstraints> queryByConstraintName(
			String constraintName) throws SQLException {
		return queryForEq(DataColumnConstraints.COLUMN_CONSTRAINT_NAME,
				constraintName);
	}
574881
function GetForeignKeys($table)
    {
        $sql = new Sql\Builder($this);
        $fields = array('TABLE_SCHEMA', 'TABLE_NAME', 'REFERENCED_COLUMN_NAME', 'CONSTRAINT_NAME');
        
        $tbl = $sql->Table('information_schema.key_column_usage', $fields);
        
        $where = $sql->Equals($tbl->Field('TABLE_SCHEMA'), $sql->Value($this->dbName))->
                And_($sql->Equals($tbl->Field('TABLE_NAME'), $sql->Value($table)))->
                And_($sql->IsNotNull($tbl->Field('REFERENCED_COLUMN_NAME')));
        $what = $sql->SelectList($tbl->Field('CONSTRAINT_NAME'));
        
        
        $select = $sql->Select(true, $what, $tbl, $where);
        $result = array();
        $reader = $this->ExecuteQuery((string)$select);
        while ($reader->Read())
        {
            $result[] = $reader->ByIndex(0);
        }
        return $result;
    }
260483
public function getTableForeignKeys($tableName = null, $connectionName = null)
    {
        $tableName = $this->validateTableName($tableName);

        return $this->getSchema($connectionName)->listTableForeignKeys($tableName);
    }
572116
public function setTableName($tableName)
    {
        if (trim($tableName) == '') {
            $tableName = null;
        }
        $this->tableName = $tableName;

        return $this;
    }
1237699
function _old_MetaForeignKeys($table, $owner=false, $upper=false)
	{
		$sql = 'SELECT t.tgargs as args
		FROM
		pg_trigger t,pg_class c,pg_proc p
		WHERE
		t.tgenabled AND
		t.tgrelid = c.oid AND
		t.tgfoid = p.oid AND
		p.proname = \'RI_FKey_check_ins\' AND
		c.relname = \''.strtolower($table).'\'
		ORDER BY
			t.tgrelid';

		$rs = $this->Execute($sql);

		if (!$rs || $rs->EOF) return false;

		$arr = $rs->GetArray();
		$a = array();
		foreach($arr as $v) {
			$data = explode(chr(0), $v['args']);
			$size = count($data)-1; //-1 because the last node is empty
			for($i = 4; $i < $size; $i++) {
				if ($upper)
					$a[strtoupper($data[2])][] = strtoupper($data[$i].'='.$data[++$i]);
				else
					$a[$data[2]][] = $data[$i].'='.$data[++$i];
			}
		}
		return $a;
	}
421676
protected function checkForeignKeyOwnerTableName($foreign, $tablename)
    {
        return $this->checkReferenceTableName($foreign ? $foreign->getReferencedTable() : null, $tablename);
    }
859823
void processAlterTableAddUniqueConstraint(Table table, HsqlName name, boolean assumeUnique) {
        boolean isAutogeneratedName = false;
        if (name == null) {
            name = database.nameManager.newAutoName("CT",
                    table.getSchemaName(), table.getName(),
                    SchemaObject.CONSTRAINT);
            isAutogeneratedName = true;

        }

        // A VoltDB extension to "readColumnList(table, false)" to support indexed expressions.
        java.util.List<Expression> indexExprs = XreadExpressions(null);
        OrderedHashSet set = getSimpleColumnNames(indexExprs);
        int[] cols = getColumnList(set, table);
        /* disable 1 line ...
        int[] cols = this.readColumnList(table, false);
        ... disabled 1 line */
        // End of VoltDB extension

        session.commit(false);

        TableWorks tableWorks = new TableWorks(session, table);

        // 
        if ((indexExprs != null) && (cols == null)) {
            // A VoltDB extension to support indexed expressions.
            // Not just indexing columns.
            // The meaning of cols shifts here to be
            // the set of unique base columns for the indexed expressions.
            set = getBaseColumnNames(indexExprs);
            cols = getColumnList(set, table);
            tableWorks.addUniqueExprConstraint(cols, indexExprs.toArray(new Expression[indexExprs.size()]), name, isAutogeneratedName, assumeUnique);
            return;
        }
        tableWorks.addUniqueConstraint(cols, name, isAutogeneratedName, assumeUnique);
        /* disable 1 line ...
        tableWorks.addUniqueConstraint(cols, name);
        ... disabled 1 line */
        // End of VoltDB extension
    }
63555
void enforceRowConstraints(Session session, Object[] data) {

        for (int i = 0; i < defaultColumnMap.length; i++) {
            Type type = colTypes[i];

            data[i] = type.convertToTypeLimits(session, data[i]);

            if (type.isDomainType()) {
                Constraint[] constraints =
                    type.userTypeModifier.getConstraints();

                for (int j = 0; j < constraints.length; j++) {
                    constraints[j].checkCheckConstraint(session, this,
                                                        data[i]);
                }
            }

            if (data[i] == null) {
                if (colNotNull[i]) {
                    Constraint c = getNotNullConstraintForColumn(i);

                    if (c == null) {
                        if (getColumn(i).isPrimaryKey()) {
                            c = this.getPrimaryConstraint();
                        }
                    }

                    String[] info = new String[] {
                        c.getName().name, tableName.name
                    };

                    throw Error.error(ErrorCode.X_23503, ErrorCode.CONSTRAINT,
                                      info);
                }
            }
        }
    }