Re: [BUGS] text cast to bool bug

2010-03-18 Thread CaT
On Thu, Mar 18, 2010 at 11:37:53AM +0100, Pavel Stehule wrote:
> postgres=# select ('true'::text)::bool;
>  bool
> --
>  t
> (1 row)
> 
> I am checked 8.3, 8.4, 9.0.

What about the 'TRUE' (all caps) case? Note the blow:

> 2010/3/18 Laczi József :
> > I think this is a funny bug:
> >
> > select ('TRUE'::TEXT)::BOOL;
> > bool
> > --
> > f
...
> > select ('true'::TEXT)::BOOL;
> > bool
> > --
> > t

-- 
  "A search of his car uncovered pornography, a homemade sex aid, women's 
  stockings and a Jack Russell terrier."
- http://www.news.com.au/story/0%2C27574%2C24675808-421%2C00.html

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] Workaround to get arrays for plperl

2008-03-30 Thread CaT
On Sun, Mar 30, 2008 at 04:23:07PM +0300, [EMAIL PROTECTED] wrote:
> It seems that function get arrays as strings in plperl.
> This is a little workaround who want pass arrays to plperl functions
> 
> my( $strarr )= @_;
> $strarr =~ s/{/[/g;
> $strarr =~ s/}/]/g;
> my $arr= eval $strarr;
> 
> NOTICE:
> you must create you function as plperlu
> and add language:
> create language plperlu;

It's late and I'm sleepy, but, that looks extremely hazardous to ones
health. Esp if the arrays you speak of have any chance of containing
anything that might look like perl code to begin with. ie think sql
injection, but with perl code rather then sql.

cat

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


[BUGS] BUG #1571: Cannot grant execute functions to non-superusers

2005-03-30 Thread CaT

The following bug has been logged online:

Bug reference:  1571
Logged by:  CaT
Email address:  [EMAIL PROTECTED]
PostgreSQL version: 7.4.7
Operating system:   Linux (Debian woody with backports.org pgsql)
Description:Cannot grant execute functions to non-superusers
Details: 

Basically, I just cannot get my nonsuperuser access to the functions I
import. Aparently this works for 8.0 but I'm using 7.4.7 and its gone all
wibbly.


CREATE OR REPLACE FUNCTION gen_salt(text) RETURNS text AS
'$libdir/pgcrypto', 'pg_gen_salt' LANGUAGE 'C';
...
postgres=# \df+ gen_salt
  List of functions
 Result data type | Schema |   Name   | Argument data types |  Owner   |
Language |Source code | Description 
--++--+-+--+
--++-
 text | public | gen_salt | text| postgres | c  
 | pg_gen_salt| 
 text | public | gen_salt | text, integer   | postgres | c  
 | pg_gen_salt_rounds | 
(2 rows)

postgres=# grant execute on function gen_salt(text) to holly;
GRANT
postgres=# select gen_salt('md5'::text);
  gen_salt   
-
 $1$CIvz7yzz
(1 row)




= [EMAIL PROTECTED]:/holly> \set VERBOSITY verbose
= [EMAIL PROTECTED]:/holly> select gen_salt('md5'::text);
ERROR:  42883: function gen_salt(text) does not exist
HINT:  No function matches the given name and argument types. You may need
to add explicit type casts.
LOCATION:  ParseFuncOrColumn, parse_func.c:323
= [EMAIL PROTECTED]:/holly> \df+ gen_salt
   List of functions
 Result data type | Schema | Name | Argument data types | Owner | Language |
Source code | Description 
--++--+-+---+--+
-+-
(0 rows)

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [BUGS] BUG #1571: Cannot grant execute functions to non-superusers

2005-03-30 Thread CaT
On Thu, Mar 31, 2005 at 01:07:56AM +0100, CaT wrote:
> 
> The following bug has been logged online:
> 
> Bug reference:  1571
> Logged by:  CaT
> Email address:  [EMAIL PROTECTED]
> PostgreSQL version: 7.4.7
> Operating system:   Linux (Debian woody with backports.org pgsql)
> Description:Cannot grant execute functions to non-superusers
> Details: 

Ok. I apparently misunderstood something. It seems you can't add global
functions and just give users access to them. You need to dupe functions
on a per db basis. So... feel free to move along and ignore this bug
report. :)

Nothing to see here... :)

-- 
"To the extent that we overreact, we proffer the terrorists the
greatest tribute."
- High Court Judge Michael Kirby

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [BUGS] BUG #1571: Cannot grant execute functions to non-superusers

2005-03-30 Thread CaT
On Wed, Mar 30, 2005 at 07:46:37PM -0500, Tom Lane wrote:
> "CaT" <[EMAIL PROTECTED]> writes:
> > = [EMAIL PROTECTED]:/holly> select gen_salt('md5'::text);
> > ERROR:  42883: function gen_salt(text) does not exist
> 
> This is not a permissions problem, it's a "you're not looking in the
> right place" problem.  I speculate that either you loaded the functions
> in the wrong database, or holly for some reason doesn't have the public
> schema in her search path.

Yes. Definately a PEBCAK issue. :)

-- 
"To the extent that we overreact, we proffer the terrorists the
greatest tribute."
- High Court Judge Michael Kirby

---(end of broadcast)---
TIP 8: explain analyze is your friend