Re: [SQL] How to order varchar data by word

2009-10-19 Thread Oliveiros C,
Hello, Adrian. Thank you for your email. I am not using any SQL at this time, but I 'd like to understand what is exactly the criterion that the ORDER BY uses to order text. Giving you some background : I need to make an efficient join between data generated by my program and data output by p

Re: [SQL] How to order varchar data by word

2009-10-19 Thread Tom Lane
"Oliveiros C," writes: > If any one can explain me exactly how the order by clause works on varchars, > I 'd really appreciate it. It sorts according to the sort order imposed by your locale setting (see LC_COLLATE in particular). A lot of locales have weird and wonderful rules that embody some

Re: [SQL] Efficiency in Multiple Queries of Same Table in a PL/PgSQL Function

2009-10-19 Thread Gary Chambers
> But if I read the OP correctly the sigma are in fact used additively in each > row in blah.  "sigma_* = sigma_* +" I apologize, but I omitted a CASE statement prior to each calculation of the values. The coefficients for each calculation change depending upon which case is valid. I could proba

[SQL] Dynamic Query

2009-10-19 Thread Andrew Hall
Hi, I'm a novice PostgreSQL developer from an Oracle background and am trying to replicate some Oracle functionality in PostgreSQL / plpgSQL. I'm trying to write a stored function to implement a search: the function has several parameters - the value of any could be 'null' on any given invocat

Re: [SQL] Dynamic Query

2009-10-19 Thread Tom Lane
Andrew Hall writes: > Is there a recommended way to translate this function into plpgSQL which > would protect me from SQL Injection (most important for me) and use bind > variables (of secondary importance? See quote_literal() and/or quote_nullable(). On the whole though I think you'd be best