X-Mozilla-Keys: 
Message-ID: <49BD32C8.4030809@yahoo.co.id>
Date: Sun, 15 Mar 2009 23:54:32 +0700
From: ataherster <ataherster@yahoo.co.id>
User-Agent: Thunderbird 2.0.0.19 (Windows/20081209)
MIME-Version: 1.0
To: Justin <justin@emproshunts.com>
Subject: Re: [GENERAL] [ask] Return Query
References: <200903142040.40789.carl.sopchak@cegis123.com>
	<200903141836.51946.aklaver@comcast.net>
	<BLU142-W128564545317B31F260873AE9A0@phx.gbl>
	<49BC9D5D.2060401@yahoo.co.id> <49BD2312.80700@emproshunts.com>
In-Reply-To: <49BD2312.80700@emproshunts.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

thanks Justin, my problem resolved, but i trying to re-create table and function, i'm using PGAdmin III to Create Script
table and function before delete my table and function, after that I run Create Sript without change my script
and working well

my question is : whether that bug in postgreSQL? 


I feel afraid if will happen again like this by itself

thanks before for your help

Note : I'm sory about my english, my english is very bad


Justin wrote:

> ataherster wrote:
>   
>> hai all, i'm trying create function like this
>>     
>> CREATE OR REPLACE FUNCTION penjualan(idcb integer)
>>     
>>  RETURNS SETOF penjualan AS
>>     
>>     
>> but this function is not work with this error : ERROR:  structure of 
>> query does not match function result type
>>     
>> CONTEXT:  PL/pgSQL function "penjualan" line 6 at RETURN QUERY
>>     
>> on the time i try with other table and working well
>>     
>> thanks for your help 
>>     
> This is because Postgresql does  know the structure of the data to be 
> returned.  So the choice either use OUT command  like so  
> http://www.postgresql.org/docs/current/static/plpgsql-declarations.html
>   
> Create or Replace Function penjualan(idcb, integer, OUT f1 text, OUT f2 
> integer) Returns SETOF penjualan AS
>   
> Or create a new data type describing the data structure   
> http://www.postgresql.org/docs/8.3/static/sql-createtype.html
>   
> Create Type myTable as ( f1 text, f2 integer)
>   
> Create or Replace Function penjualan(idcb, integer) Returns SETOF 
> myTable  AS
>   
>   
>   


