Обсуждение: Temporary table

Поиск
Список
Период
Сортировка

Temporary table

От
"Juris Krumins"
Дата:
There is a query:
$sqlcmd = "CREATE TEMP TABLE tmp_table1 AS SELECT " .$p_distinct. " "
.$sql_columns. " FROM " .$sql_table ;
Next I have command:
$sqlcmd_tmp = $sqlcmd;
$tmp_res = pg_Exec( $conn, $sqlcmd_tmp );
Always it's ok, so it's execute without any problems. But sometimes I get
error like this :
Warning: pg_exec()[function.pg-exec]:Query failed:ERROR: cache lookup of
relation 149064743 failed.

A little bit further I have code like this :
$sqlcmd_count = "SELECT * FROM tmp_table1";
$tmp_count = pg_Exec( $conn, $sqlcmd_count );
So it's also working well, but as in previous example sometimes I'm getting
error like that:
Warning: pg_exec()[function.pg-exec]:Query failed: ERROR: Relation
"tmp_table1" does not exist.

So I'd like to know why it is so. Are there any config parameters, which are
responsible for creating temporaty tables and so on. And the other thing is
can't it be depend on max amount of clients server can support (or maybe
shared memory and so on).
Anyway thanks for answers.



Re: Temporary table

От
Tom Lane
Дата:
"Juris Krumins" <juriskr@komin.lv> writes:
> Always it's ok, so it's execute without any problems. But sometimes I get
> error like this :
> Warning: pg_exec()[function.pg-exec]:Query failed:ERROR: cache lookup of
> relation 149064743 failed.

Hmm, that seems bad.  Is the given relation number always the same?  Is
there a row with that OID in pg_class?  (Try "select * from pg_class
where oid = 149064743".)

What PG version is this?

            regards, tom lane