Re: Special table names

Поиск
Список
Период
Сортировка
От Michael Wood
Тема Re: Special table names
Дата
Msg-id 5a8aa6681002260659r331219f9u7b3d72e9edcdca2f@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Special table names  (Marcin Krol <mrkafk@gmail.com>)
Ответы Re: Special table names  (Marcin Krol <mrkafk@gmail.com>)
Список pgsql-novice
On 26 February 2010 15:35, Marcin Krol <mrkafk@gmail.com> wrote:
> Michael Wood wrote:
>
>>
>> In addition to what Andreas said, try "\dS" (and "\?").
>
> Thanks, that's useful -- but that still doesn't let me tell where 'user'
> table (view? alias?) comes from.
>
>> You should probably use "CREATE ROLE", "ALTER ROLE", "DROP ROLE" etc.
>> instead of manipulating pg_user directly.
>
> I have no intention to do that; I just created test db via ORM called
> SQLAlchemy, with table named 'user'.

It seems SQLAlchemy lied to you about creating the table, or perhaps
you did not check an error code or something.

blah=> create table user (id int);
ERROR:  syntax error at or near "user"
LINE 1: create table user (id int);
                     ^

Note that it says "syntax error" and not "relation already exists".

> Then I drop into psql, do 'select * from user' to see what's in there and I
> don't see what I expected to see:
>
> ts=# \c ts;
>
> ts=# select * from user;
>  current_user
> --------------
>  postgres
> (1 row)
>
>
> So I'm wondering if there are other special table names I should avoid.

I suppose any function in the list Andreas pointed you at that don't
have parentheses.  Also anything called pg_something.  Not sure what
else.

--
Michael Wood <esiotrot@gmail.com>

В списке pgsql-novice по дате отправления:

Предыдущее
От: Michael Wood
Дата:
Сообщение: Re: Special table names
Следующее
От: Marcin Krol
Дата:
Сообщение: Re: Special table names