472,783 Members | 903 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,783 software developers and data experts.

which Schema I am working on??

Hi all,
I am writing a pl/psql function with a temp table right now.
It creates the temp table inside. Whenever I call this function in a
session for the first time, it creates a shema, namely pg_temp_number,
automatically and it creates the temp table within the schema. I've
tried to add a check inside the function to check have the temp table
been already existed. The function will look like :

CREATE OR REPLACE FUNCTION reffunc(refcursor, varchar(10),
varchar(10)) RETURNS refcursor AS '
= ''tablexxx'')) = 1 THEN
EXECUTE ''DROP TABLE tablexxx '';
EXECUTE ''create local temp table tablexxx (repno character(15),
date date)'';
EXECUTE ''insert into tablexxx (repno, date) VALUES (
''||quote_literal($2)||'', now() )'';
EXECUTE ''insert into tablexxx (repno, date) VALUES (
''||quote_literal($3)||'', now() )'';
OPEN $1 for EXECUTE '' SELECT * FROM tablexxx '';
' LANGUAGE 'plpgsql';

It works fine as long as there is only one session (or only one client)
calling and called this function. For example, if one session has called
the funciton and the session is not terminated yet, then other session
call this function again, the function would find there is already a
table called tablexxx in the pg_tables and it tries to drop the table.
However, there is not table tablexxx belonged to the second session
actually. Therefore, the function would fail with this error message:

ERROR: table "tablexxx" does not exist

Firstly, is there anyway to find out which Schema I am working on, so I
could query the pg_tables with a specified schemaname??

Second, I am wondering how could I drop the automically created schema
automically? Could I config the system to make it drop the correpsonding
schema whenever a session is terminated?

Thank You Very Much.

Harry Yau
Nov 11 '05 #1
0 1177

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: joes | last post by:
Hello there I tried for several days to get a simple validation with xml schema & xerces working. Goal for me is tuse JAXP and not specific Xerces classes. I don't get the point what I am doing...
by: stiank81 | last post by:
Hi. I have a problem witch I assume there is an answear to....? I have several XML schemas, and they all have quiet a lot of definitions in common. They still have to be seperated into...
by: Harry Yau | last post by:
Hi all, I am writing a pl/psql function with a temp table right now. It creates the temp table inside. Whenever I call this function in a session for the first time, it creates a shema, namely...
by: Poonam | last post by:
Hi, Can some one please help me with (or point me to) a very simple but working code sample that shows how to import XML Schema. I have tried many samples out there on internet but nothing seems...
by: Iain A. Mcleod | last post by:
Hi I'm stuck with the following schema validation problem in VS.NET 2003: I have two types of xml document and related schema: project and projectCollection. A projectcollection is just a set...
by: Derek | last post by:
I am creating an intranet using Visual Web Developer Express Edition. Everything has been working OK until yesterday when I started getting 62 messages all beginning "Could not find schema...
by: Reuven Nisser | last post by:
Hi, How can I describe an XML like this: <X> <Y/> <Z/> <Y/> <Y/> </X>
by: cmay | last post by:
I am beginning to wonder if it is not possible to get this working. I am trying to do: <root> <a/> <b/> <c/> </root>
by: icesign | last post by:
I know that the selector of these elements has a scope relative to the element being declared, but maybe there is a way to get beyond bounds of this scope or maybe just a way to extend base element?...
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
by: lllomh | last post by:
How does React native implement an English player?
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.