Again about temporary table

Started by Juris Kruminsover 22 years ago1 messagesgeneral
Jump to latest
#1Juris Krumins
juriskr@komin.lv

Just additional information I'd like to tell.
I've got an additional error:
Relation blablabla already exists.
It's also connected with previous mail command about cretating temporary
table.
Greep'ing though src code I'v found almost on;y one place where sush kind of
error can happen:
src/backend/catalog/heap.c: 712
It's a
heap_create_with_catalog(const char *relname,
Oid relnamespace,
TupleDesc tupdesc,
char relkind,
bool shared_relation,
bool
allow_system_table_mods) ( ) function which is
/* --------------------------------
* heap_create_with_catalog
*
* creates a new cataloged relation. see comments above.
* --------------------------------
*/
as it is in src code.
May be it'll help someone to solve my problem.

----- Original Message -----
From: "Juris Krumins" <juriskr@komin.lv>
To: <pgsql-general@postgresql.org>
Sent: Wednesday, August 27, 2003 10:39 AM
Subject: Again about temporary table

Couple a weeks ago (19.08.03 Subject: Temporaty tables) I've posted

message

with question about errors I'm getting while using create temporaty table
command.
So I'm start digging in src code as Tom Lane did and found about 4 places
where such kind pf errors could happend

PostgreSQL 7.3.3

src/backend/catalog/dependency.c : 1621
src/backend/catalog/heap.c : 1663
src/backend/catalog/pg_constraint.c : 445
src/backend/utils/adt/ruleutils.c : 3125

As I see all this errors depend on HeapTupleIsValid() function return

code.

If it's false then error happend.

In
1) src/backend/utils/adt/ruleutils.c : 3125 HeapTupleIsValid() function

is

used in generate_relation_name(Oid relid), which is as I understand
resposible to convert relid identificator into relation name
2) src/backend/catalog/dependency.c : 1621 HeapTupleIsValid() function is
used in getRelationDescription(StringInfo buffer, Oid relid) function,

which

is getting relation description while specify relid.
3) src/backend/catalog/heap.c : 1663 HeapTupleIsValid() function is used

in

SetRelationNumChecks(Relation rel, int numchecks) function. I don't realy
understand the meaning of that function
4) src/backend/catalog/pg_constraint.c : 445 HeapTupleIsValid() function

is

used in RemoveConstraintById(Oid conId) which is responsible for delete

a

single constraint record.

So any ideas why I'm getting errors like:
Warning: pg_exec() [function.pg-exec]: Query failed: ERROR: cache lookup

of

relation 149064743 failed . in table.php on line 169
The query on line 169 is :

CREATE TEMP TABLE tmp_table1 AS SELECT advert.time_create, (SELECT
employer.fullname FROM employer WHERE advert.empid=employer.id) as

emp_name,

(CASE WHEN advert.status1 = 'A' THEN advert.postname1 ELSE

advert.postname2

Show quoted text

END) as postname, advert.enddate, advert.id as id FROM good_adv as advert

And right ahead

Warning: pg_exec()[function.pg-exec]:Query failed: ERROR: Relation
"tmp_table1" does not exist.

On query like :

SELECT * FROM tmp_table1