

 O Amazon Redshift não permitirá mais a criação de UDFs do Python a partir do Patch 198. As UDFs do Python existentes continuarão a funcionar normalmente até 30 de junho de 2026. Para ter mais informações, consulte a [publicação de blog ](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/). 

# PG\$1TABLE\$1DEF
<a name="r_PG_TABLE_DEF"></a>

Armazena informações sobre colunas de tabela.

PG\$1TABLE\$1DEF retorna somente informações sobre tabelas visíveis para o usuário. Se PG\$1TABLE\$1DEF não retornar os resultados esperados, verifique se o parâmetro [search\$1path](r_search_path.md) está definido corretamente para incluir os esquemas relevantes.

Você pode usar [SVV\$1TABLE\$1INFO](r_SVV_TABLE_INFO.md) para visualizar mais informações abrangentes sobre uma tabela, inclusive distorção dos dados, distorção da distribuição da chave, tamanho da tabela e estatísticas. 

## Colunas da tabela
<a name="r_PG_TABLE_DEF-table-columns2"></a>

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/pt_br/redshift/latest/dg/r_PG_TABLE_DEF.html)

## Exemplo
<a name="r_PG_TABLE_DEF-example2"></a>

O exemplo a seguir mostra as colunas da chave de classificação composta da tabela LINEORDER\$1COMPOUND.

```
select "column", type, encoding, distkey, sortkey, "notnull" 
from pg_table_def
where tablename = 'lineorder_compound' 
and sortkey <> 0;

column       | type    | encoding | distkey | sortkey | notnull
-------------+---------+----------+---------+---------+--------
lo_orderkey  | integer | delta32k | false   |       1 | true   
lo_custkey   | integer | none     | false   |       2 | true   
lo_partkey   | integer | none     | true    |       3 | true   
lo_suppkey   | integer | delta32k | false   |       4 | true   
lo_orderdate | integer | delta    | false   |       5 | true   
(5 rows)
```

 O exemplo a seguir mostra as colunas da chave de classificação intercalada da tabela LINEORDER\$1INTERLEAVED.

```
select "column", type, encoding, distkey, sortkey, "notnull" 
from pg_table_def
where tablename = 'lineorder_interleaved' 
and sortkey <> 0;

column       | type    | encoding | distkey | sortkey | notnull
-------------+---------+----------+---------+---------+--------
lo_orderkey  | integer | delta32k | false   |      -1 | true   
lo_custkey   | integer | none     | false   |       2 | true   
lo_partkey   | integer | none     | true    |      -3 | true   
lo_suppkey   | integer | delta32k | false   |       4 | true   
lo_orderdate | integer | delta    | false   |      -5 | true   
(5 rows)
```

PG\$1TABLE\$1DEF retornará somente informações de tabelas nos esquemas incluídos no caminho de pesquisa. Para obter mais informações, consulte [search\$1path](r_search_path.md).

Por exemplo, suponhamos que você crie um novo esquema e uma nova tabela e, em seguida, consulte PG\$1TABLE\$1DEF.

```
create schema demo;
create table demo.demotable (one int);
select * from pg_table_def where tablename = 'demotable';

schemaname|tablename|column| type | encoding | distkey | sortkey | notnull 
----------+---------+------+------+----------+---------+---------+--------
```

A consulta não retorna linhas para a nova tabela. Examine a configuração de `search_path`.

```
show search_path;

  search_path
---------------
 $user, public
(1 row)
```

Adicione o esquema `demo` ao caminho de pesquisa e execute a consulta novamente.

```
set search_path to '$user', 'public', 'demo';

select * from pg_table_def where tablename = 'demotable';

schemaname| tablename |column|  type   | encoding |distkey|sortkey| notnull
----------+-----------+------+---------+----------+-------+-------+--------
demo      | demotable | one  | integer | none     | f     |     0 | f
(1 row)
```