Re: [GENERAL] Wrong "ORDER BY" on a numeric value result

2010-08-15 Thread Stefan Wild
Thank you guys! That was the point. --- hubert depesz lubaczewski schrieb am So, 15.8.2010: > Von: hubert depesz lubaczewski > Betreff: Re: [GENERAL] Wrong "ORDER BY" on a numeric value result > An: "Stefan Wild" > CC: pgsql-general@postgresql.org > Datum: Sonntag, 15. August, 2010 05:53 Uhr

Re: [GENERAL] Wrong "ORDER BY" on a numeric value result

2010-08-15 Thread Thomas Kellerer
Stefan Wild wrote on 15.08.2010 10:36: column is numeric, but upper() works on text, and returns text, so your numeric column got casted to text by using upper (which is pointless anyway - there is no "upper" version of digits). remove upper() and you'll be fine. Thank you guys! That was the

Re: [GENERAL] InitDB: Bad system call

2010-08-15 Thread Alban Hertroys
On 15 Aug 2010, at 7:32, Tom Lane wrote: > =?ISO-8859-15?Q?Torsten_Z=FChlsdorff?= writes: >> Core was generated by `postgres'. >> Program terminated with signal 12, Bad system call. >> Reading symbols from /lib/libm.so.5...done. >> Loaded symbols for /lib/libm.so.5 >> Reading symbols from /lib/li

Re: [GENERAL] undefined symbol: PQconnectdbParams

2010-08-15 Thread Sim Zacks
>> When I try using createdb or createlang I get the error: >> >> undefined symbol: PQconnectdbParams > It's probably finding the wrong library. Which binaries are you using? > If you do "ldd /path/to/binary", what does it show? Maybe you need to > set LD_LIBRARY_PATH to the "lib" directory of you

[GENERAL] return setof : alternatives to holder table

2010-08-15 Thread zhong ming wu
Hello List, I have a plpgsql function returning a set of records. The record is effectively a join of some tables. For example, table a (column a1,column a2,column a3,column a4) table b(column b1,column b2,column b4) I am returning a set of (a2,a4,b2). What I do now is to create a empty table

Re: [GENERAL] return setof : alternatives to holder table

2010-08-15 Thread Craig Ringer
On 15/08/10 18:00, zhong ming wu wrote: > Thanks for any better solution to this CREATE TYPE However, you still have to have a special type around just for that function, and you have to *maintain* it to ensure it always matches the types/columns of the input tables. I frequently wish for type

Re: [GENERAL] return setof : alternatives to holder table

2010-08-15 Thread A. Kretschmer
In response to zhong ming wu : > Hello List, > > I have a plpgsql function returning a set of records. The record is > effectively a join of some tables. > > For example, table a (column a1,column a2,column a3,column a4) > > table b(column b1,column b2,column b4) > > I am returning a set of (a

Re: [GENERAL] return setof : alternatives to holder table

2010-08-15 Thread Mike Christensen
On Sun, Aug 15, 2010 at 3:10 AM, Craig Ringer wrote: > On 15/08/10 18:00, zhong ming wu wrote: > > > Thanks for any better solution to this > > CREATE TYPE > > However, you still have to have a special type around just for that > function, and you have to *maintain* it to ensure it always matches

Re: [GENERAL] return setof : alternatives to holder table

2010-08-15 Thread Craig Ringer
On 15/08/2010 6:18 PM, Mike Christensen wrote: How about just using OUT parameters? CREATE FUNCTION FOO(IN _id uuid, OUT col1 text, OUT col2 text) RETURNS SETOF record AS BEGIN select col1, col2 from test where id=_id; END; Then your output just has to match the signature of

[GENERAL] Relationship between ulimit and effective_cache_size, work_mem, shared_buffers, maintenance_work_mem and vacuum

2010-08-15 Thread Sandeep Srinivasa
hi guys, we have a single Ubuntu 10.04 box on which we are going to be running a Postgres 8.4 server, ROR passenger and a solr search server. I was looking at ways to optimize the postgres database and yet limit the amount of memory that it can consume. I am gonna set my shared_buffer

Re: [GENERAL] return setof : alternatives to holder table

2010-08-15 Thread zhong ming wu
On Sun, Aug 15, 2010 at 6:18 AM, Mike Christensen wrote: > On Sun, Aug 15, 2010 at 3:10 AM, Craig Ringer > wrote: >> >> On 15/08/10 18:00, zhong ming wu wrote: >> >> > Thanks for any better solution to this >> >> CREATE TYPE >> >> However, you still have to have a special type around just for tha

Re: [GENERAL] InitDB: Bad system call

2010-08-15 Thread Torsten Zühlsdorff
Alban Hertroys schrieb: Core was generated by `postgres'. Program terminated with signal 12, Bad system call. Reading symbols from /lib/libm.so.5...done. Loaded symbols for /lib/libm.so.5 Reading symbols from /lib/libc.so.7...done. Loaded symbols for /lib/libc.so.7 Reading symbols from /libexe

Re: [GENERAL] return setof : alternatives to holder table

2010-08-15 Thread Joe Conway
On 08/15/2010 07:57 AM, zhong ming wu wrote: > Here is what I have tried > > create or replace function te(out a int,out b int) returns setof record as > $pgsql$ > declare > r record; > begin > r.a := 1; > r.b := 2; > return next; > end; > $pgsql$ language plpgsql; Try: create or replace functio

Re: [GENERAL] InitDB: Bad system call

2010-08-15 Thread Tom Lane
=?ISO-8859-1?Q?Torsten_Z=FChlsdorff?= writes: > The problems are known and i already have taken care of it. As written > at the beginning i already have two jails at the server with running > postgresql-instances. > Normally you have to tweak up the IPC-Params and use different user-ids > for e

Re: [GENERAL] InitDB: Bad system call

2010-08-15 Thread Torsten Zühlsdorff
Hello, Well, this seems to be clear proof for what everyone suspected all along: your kernel is rejecting SysV-shared-memory calls. I'm too tired to go check that that shmctl() is the first such syscall during the boot sequence, but it looks about right. So we're now back to the question of *w

Re: [GENERAL] return setof : alternatives to holder table

2010-08-15 Thread zhong ming wu
On Sun, Aug 15, 2010 at 12:21 PM, zhong ming wu wrote: > On Sun, Aug 15, 2010 at 11:57 AM, Joe Conway wrote: >> On 08/15/2010 07:57 AM, zhong ming wu wrote: >>> Here is what I have tried >>> >>> create or replace function te(out a int,out b int) returns setof record as >>> $pgsql$ >>> declare >>>

Re: [GENERAL] InitDB: Bad system call

2010-08-15 Thread Tom Lane
I wrote: > ... The simplest explanation > I can think of is that it's *only* shmctl that is malfunctioning, not > the other SysV shared memory calls. Which is even weirder, and > definitely seems to move the problem into the category of kernel bug > rather than configuration mistake. Hmmm ... Goo

Re: [GENERAL] .psqlrc and custom functions (mysql-like)

2010-08-15 Thread Pavel Stehule
Hello 2010/8/14 Sandeep Srinivasa : > hi, >   As part of a product we are building, we are using postgres as our > database. But most of our developers have a (loud) mysql background. > I want to potentially provide "aliases" for a few commonly used mysql > functions. >  I see that the .psqlrc cou