Re: BUG #13601: bit as quoted column in output

From: "Vicky Soni - Quipment India" <vicky(dot)soni(at)quipment(dot)nl>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13601: bit as quoted column in output
Date: 2015-09-02 12:21:38
Message-ID: 640a4cb4678b4d0f8afc6e8d65af5405@Strand.quipment.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi David,

Please refer following code and attached screenshots.

create or replace function bit_return_testing()
returns table (OutBit bit) as
$BODY$
declare SQL VARCHAR;
Begin
sql:='select cast(1 as bit) ';
raise notice '%',SQL;
RETURN QUERY EXECUTE SQL;

end;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100
ROWS 1000;

select * from bit_return_testing();

It give me output like this.

[cid:image001(dot)png(at)01D0E5A8(dot)021B62C0]

Now if I call same statement directly, i.e.

select cast(1 as bit) ;

It gives me output like this.

[cid:image002(dot)png(at)01D0E5A8(dot)021B62C0]

Now my question/doubt/concern was why did it throw “bit” to me into first example and not simple bit?

Please advice.

Thanks & Regards,
Vicky Soni
Database Administrator

From: David G. Johnston [mailto:david(dot)g(dot)johnston(at)gmail(dot)com]
Sent: 01 September 2015 22:36
To: Vicky Soni - Quipment India <vicky(dot)soni(at)quipment(dot)nl>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: [BUGS] BUG #13601: bit as quoted column in output

On Tuesday, September 1, 2015, <vicky(dot)soni(at)quipment(dot)nl<mailto:vicky(dot)soni(at)quipment(dot)nl>> wrote:
The following bug has been logged on the website:

Bug reference: 13601
Logged by: Vicky Soni
Email address: vicky(dot)soni(at)quipment(dot)nl<javascript:;>
PostgreSQL version: 9.3.9
Operating system: Windows
Description:

Hi,

I am trying to return a result set using dynamic query from a postgresql
function.

Function runs ok but when returning bit data type in one of the columns from
output table, I get it as "bit" which should be bit only. Now executing same
query outside of the function in normal mode, it returns column with bit
data type only.

Please guide me.

Provide examples.

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message ugurlu2001 2015-09-02 14:45:58 BUG #13607: Creating "Readonly" User for public Shema.
Previous Message Michael Paquier 2015-09-02 10:59:06 Re: BUG #13606: CHECK clause in CREATE TABLE command