Re: string = any() - Mailing list pgsql-general

From Filip Rembiałkowski
Subject Re: string = any()
Date
Msg-id CAP_rwwnmR+Y+_FhWw5VK21+D5jh4y=LrxuABCeq2SJ+KbAi4jg@mail.gmail.com
Whole thread Raw
In response to Re: string = any()  ("David Johnston" <polobo@yahoo.com>)
List pgsql-general
W dniu 10 stycznia 2012 22:52 użytkownik David Johnston
<polobo@yahoo.com> napisał:

> If you are going to supply one parameter per "possible value" anyway skip the whole "ANY" and "ARRAY" and just say "
'bob'IN ($1, $2 [,...]) "; 

true :-)

<?php
$names = array( "joe", "bob" );
$placeholders = implode( ",", array_map( function($x){return "?"}, $names ) );
$sql = "select 'bob' IN ($placeholders)";
$stmt = $dbh->prepare($sql);
$stmt->execute($names);
?>

PHP from several years cries for postgres array support in PDO. And
personally I would rather discourage programmers from constructing
delimited array string in code - more complicated than first option,
needs careful character escaping, etc.


select array['a',null,'','tab is  ','quote is "','comma is ,'];
                         array
-------------------------------------------------------
 {a,NULL,"","tab is      ","quote is \"","comma is ,"}

pgsql-general by date:

Previous
From: Mike Christensen
Date:
Subject: Re: Can a function return more then one table?
Next
From: Kirill Müller
Date:
Subject: Enumeration of tables is very slow in largish database