Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8263543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:08:32+00:00 2026-06-08T04:08:32+00:00

I have the following situation which generates a OID error when retriving data from

  • 0

I have the following situation which generates a OID error when retriving data from the table table_generated_by_my_other_function that is generated by the first part of the loop when the nested function my_other_function() is called. How can this be fixed?

The function function my_other_function() generates a table with just one row of data with 7 columns, so could this results be stored or returned in some other way? Do I get the error becuase the table doesn’t exists without a commit?

function my_other_function() works OK on its own.

CREATE OR REPLACE FUNCTION my_function() RETURNS varchar AS  $$
    DECLARE 
        row_data RECORD;
        helper int;
    BEGIN 
        EXECUTE '
            DROP TABLE IF EXISTS my_table_loop_result;
        ';
        EXECUTE '
            CREATE TABLE my_table_loop_result (
                var1 varchar, var2 varchar, var3 varchar, var4 int, 
                var5 varchar, var6 varchar, var7 int)
        ';

        FOR row_data IN SELECT var_x1, var_x2 FROM my_table_too
        LOOP
                SELECT my_other_function(row_data.var_x1, row_data.var_x2) INTO helper; --Returns "1" if OK    

                INSERT INTO my_table_loop_result(var1,var2,var3,var4,var5,var6.var7)
                SELECT 
                    var1,var2,var3,var4,var5,var6,var7
                FROM table_generated_by_my_other_function --OID ERROR!
                WHERE var1 = row_data.var1;
        END LOOP;
    RETURN 1;
    END;
$$ LANGUAGE plpgsql;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T04:08:34+00:00Added an answer on June 8, 2026 at 4:08 am

    8.2 is really obsolete – in this version, you should not drop temporary table ever.

    PlpgSQL uses prepared statements, that contains execution plans with references to related tables. When you drop table, then saved plan is invalid – because reference is broken. New versions release plan in this case – but this is not true in 8.2. So – do upgrade or check if your table exists first and if exists then truncate it instead drop. When table doesn’t exists, then create it. Other solution – use only dynamic SQL.

    Some comments: you don’t need dynamic SQL for CREATE TABLE or DROP TABLE.

    http://archives.postgresql.org/pgsql-bugs/2002-07/msg00051.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following situation: An Conversations entity/table which has multiple Tags associated to
Hey I have the following situation: a WinService which is processing some stuff from
I have following situation - Have a MongoService class, which reads host, port, database
I have the following situation in code, which I suspect may be a bit
I have a following situation in my project. There are some tag values which
Consider the following situation: I have two android projects named P1 and P2 which
I have following situation, String a=<em>crawler</em> <em> Yeahhhhh </em></a></h3><table; System.out.println(a.indexOf(</em>)); It returns the 11
I have following Situation, Server A sends some data (HTML form) to server B,
Situation: I have a C# program which does the following: Generate many files (replacing
My situation is following. I have one Activity that contains three main parts. At

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.