pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vicky Soni - Quipment India <vicky.soni@quipment.nl>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: BUG #13601: bit as quoted column in output
Date: Wed, 2 Sep 2015 12:21:38 +0000
Message-ID: <640a4cb4678b4d0f8afc6e8d65af5405@Strand.quipment.local> (raw)
In-Reply-To: <CAKFQuwaKMOLaF1QL80qf1knGZw5KnozExCUSvKz8iX5nXJ_Mww@mail.gmail.com>
References: <20150901124233.2090.28039@wrigleys.postgresql.org>
	<CAKFQuwaKMOLaF1QL80qf1knGZw5KnozExCUSvKz8iX5nXJ_Mww@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.png@01D0E5A8.021B62C0]

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

select cast(1 as bit) ;

It gives me output like this.

[cid:image002.png@01D0E5A8.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.g.johnston@gmail.com]
Sent: 01 September 2015 22:36
To: Vicky Soni - Quipment India <vicky.soni@quipment.nl>
Cc: pgsql-bugs@postgresql.org
Subject: Re: [BUGS] BUG #13601: bit as quoted column in output

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

Bug reference:      13601
Logged by:          Vicky Soni
Email address:      vicky.soni@quipment.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.


Attachments:

image001.png (image/png, 4.5K) download view image
image002.png (image/png, 5.0K) download view image

view thread (6+ messages)  latest in thread

Message-ID: <640a4cb4678b4d0f8afc6e8d65af5405@Strand.quipment.local>
Permalink:  ../640a4cb4678b4d0f8afc6e8d65af5405@Strand.quipment.local/
Also on:    postgresql.org/message-id/640a4cb4678b4d0f8afc6e8d65af5405@Strand.quipment.local

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: vicky.soni@quipment.nl, david.g.johnston@gmail.com
  Subject: Re: BUG #13601: bit as quoted column in output
  In-Reply-To: <640a4cb4678b4d0f8afc6e8d65af5405@Strand.quipment.local>
  References: <20150901124233.2090.28039@wrigleys.postgresql.org> <CAKFQuwaKMOLaF1QL80qf1knGZw5KnozExCUSvKz8iX5nXJ_Mww@mail.gmail.com> <640a4cb4678b4d0f8afc6e8d65af5405@Strand.quipment.local>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox