Re: [GENERAL] replacing single quotes

2007-10-10 Thread Albe Laurenz
Ow Mun Heng wrote: Input is of form 'ppp','aaa','bbb' I want it to be stripped of quotes to become ppp,aaa,bbb escaping the quote would work but it means I will have to do some magic on the input as well to escape it prior to replacing it. select replace('AB\'A','\'','C') this

[GENERAL] pgodbc + Excel + msquery + background refresh

2007-10-10 Thread Ow Mun Heng
Just wonder if anyone here uses Excel to connect to PG via ODBC. I'm using it extensively as my platform to get data from PG/MSSQL directly into excel. (Excel uses the msqry32.exe file which is like a stripped down sql query tool and returns data directly into excel) When using mssql, connecting

Re: [GENERAL] SLEEP in posgresql

2007-10-10 Thread Jasbinder Singh Bali
What if its just SLEEP for 1 second. Why would it keep my stored procedure hanging ? On 10/10/07, Michal Taborsky - Internet Mall [EMAIL PROTECTED] wrote: Jasbinder Singh Bali napsal(a): Instead of that, I re-engineered my while loop in the stored procedure as follows. ... I was

Re: [GENERAL] replacing single quotes

2007-10-10 Thread Ow Mun Heng
On Wed, 2007-10-10 at 09:11 +0200, Albe Laurenz wrote: Ow Mun Heng wrote: Input is of form 'ppp','aaa','bbb' I want it to be stripped of quotes to become ppp,aaa,bbb escaping the quote would work but it means I will have to do some magic on the input as well to escape it

[GENERAL] Upper and Lower-cased Database names?

2007-10-10 Thread Daniel B. Thurman
I am finding out for the first time that by having a database created with the name: MyTest, I cannot do a simple query as follows: postgres=# select * from MyTest.public.cars; ERROR: cross-database references are not implemented: mytest.public.cars Notice, however since I created a cars table

Re: [GENERAL] Upper and Lower-cased Database names?

2007-10-10 Thread Christian Rengstl
This error probably does not have anything to do with the case of your database name. Instead you probably logged into a database which is not MyTest, because it is not possible to log into a database x and make a query on database y. Christian Rengstl M.A. Klinik und Poliklinik für Innere

Re: [GENERAL] Upper and Lower-cased Database names?

2007-10-10 Thread Richard Huxton
Daniel B. Thurman wrote: I am finding out for the first time that by having a database created with the name: MyTest, I cannot do a simple query as follows: postgres=# select * from MyTest.public.cars; ERROR: cross-database references are not implemented: mytest.public.cars Correct - a query

Re: [GENERAL] SLEEP in posgresql

2007-10-10 Thread Michal Taborsky - Internet Mall
Jasbinder Singh Bali napsal(a): Instead of that, I re-engineered my while loop in the stored procedure as follows. ... I was wondering how to implement the SLEEP functionality here. Hello. I can't comment the function itself, but I want to bring something else to your attention. Note, that

Re: [GENERAL] Upper and Lower-cased Database names?

2007-10-10 Thread Harald Armin Massa
Daniel, please try: select * from MyTest.public.cars; mixed cases need those , per SQL-Standard. In my experienced mixed cases in qualifiers which cross OS-barriers cause more trouble then use (... filenames with WebServers ...) Harald postgres=# select * from MyTest.public.cars; ERROR:

Re: [GENERAL] SLEEP in posgresql

2007-10-10 Thread Richard Huxton
Jasbinder Singh Bali wrote: What if its just SLEEP for 1 second. Why would it keep my stored procedure hanging ? Because presumably your loop-condition isn't under your control (otherwise you wouldn't need to sleep). Can you *always* guarantee the condition (a=b) will happen within a

Re: [GENERAL] SLEEP in posgresql

2007-10-10 Thread Jasbinder Singh Bali
my loop is a busy wait and keeps iterating until a=b condition is met. However, it would lead to millions of instructions executing per second. So to save resources, I want to keep a sleep before re-iterating. Don't understand how is SLEEP disastrous here even if i don't know when is my loop

Re: [GENERAL] SLEEP in posgresql

2007-10-10 Thread Richard Huxton
Jasbinder Singh Bali wrote: my loop is a busy wait and keeps iterating until a=b condition is met. However, it would lead to millions of instructions executing per second. So to save resources, I want to keep a sleep before re-iterating. Don't understand how is SLEEP disastrous here even if i

Re: [GENERAL] replacing single quotes

2007-10-10 Thread Albe Laurenz
Ow Mun Heng wrote: Input is of form 'ppp','aaa','bbb' I want it to be stripped of quotes to become ppp,aaa,bbb I'm a little confused that you think that you will have to escape single quotes in the input. What is your use case? Normally the input is in some variable in some

Re: [GENERAL] Upper and Lower-cased Database names?

2007-10-10 Thread Ian Barwick
2007/10/10, Daniel B. Thurman [EMAIL PROTECTED]: I am finding out for the first time that by having a database created with the name: MyTest, I cannot do a simple query as follows: postgres=# select * from MyTest.public.cars; ERROR: cross-database references are not implemented:

Re: [GENERAL] DB upgrade

2007-10-10 Thread Andrew Kelly
On Tue, 2007-10-09 at 11:46 +0200, Andrew Kelly wrote: Hi folks, please forgive what feels like a no-brainer even as I ask it, but... snip Just wanted to thank everybody who's provided feedback. I'm squared away now, and very appreciative of all the help. Andy

Re: [GENERAL] SLEEP in posgresql

2007-10-10 Thread Jasbinder Singh Bali
I don't know how is a sleep of 1 second going to be harmful here instead of keeping a busy wait. Even if a=b is going to take 1 week as u say, isn't a sleep of 1 second, if nothing, would save some CPU resources instead of blindly looping for ever ? Aren't busy On 10/10/07, Richard Huxton [EMAIL

[GENERAL] ORDER BY - problem with NULL values

2007-10-10 Thread Stefan Schwarzer
Hi there, if I order a given year in DESCending ORDER, so that the highest values (of a given variable) for the countries are displayed at the top of the list, then actually the NULL values appear as first. Only below, I find the values ordered correctly. Is there any way to a) make

Re: [GENERAL] SLEEP in posgresql

2007-10-10 Thread Jasbinder Singh Bali
I don't know how is a sleep of 1 second going to be harmful here instead of keeping a busy wait. Even if a=b is going to take 1 week as u say, isn't a sleep of 1 second, if nothing, would save some CPU resources instead of blindly looping for ever ? Aren't busy waits dangerous from CPU resources

Re: [GENERAL] replacing single quotes

2007-10-10 Thread Ow Mun Heng
On Wed, 2007-10-10 at 10:46 +0200, Albe Laurenz wrote: Ow Mun Heng wrote: Input is of form 'ppp','aaa','bbb' I want it to be stripped of quotes to become ppp,aaa,bbb I'm a little confused that you think that you will have to escape single quotes in the input. What is

Re: [GENERAL] How to speedup intarray aggregate function?

2007-10-10 Thread Dmitry Koterov
Thanks for your comment. I see two possible solution directions: 1. Is it possible to create C-function, which could accept something like ROWSET(ARRAY[]) in its input parameters? E.g. to call it as SELECT array_rowset_glue((SELECT arrayfield FROM arraytable)); or something like this? 2. Is

Re: [GENERAL] SLEEP in posgresql

2007-10-10 Thread Richard Huxton
Jasbinder Singh Bali wrote: I don't know how is a sleep of 1 second going to be harmful here instead of keeping a busy wait. Even if a=b is going to take 1 week as u say, isn't a sleep of 1 second, if nothing, would save some CPU resources instead of blindly looping for ever ? Aren't busy waits

Re: [GENERAL] ORDER BY - problem with NULL values

2007-10-10 Thread Richard Huxton
Stefan Schwarzer wrote: Hi there, if I order a given year in DESCending ORDER, so that the highest values (of a given variable) for the countries are displayed at the top of the list, then actually the NULL values appear as first. Only below, I find the values ordered correctly. Is there

Re: [GENERAL] How to speedup intarray aggregate function?

2007-10-10 Thread Dmitry Koterov
Wow, seems I've found that! * Beginning in PostgreSQL 8.1, the executor's AggState node is passed as * the fmgr context value in all transfunc and finalfunc calls. It is * not really intended that the transition functions will look into the * AggState node, but they can

Re: [GENERAL] ORDER BY - problem with NULL values

2007-10-10 Thread Stefan Schwarzer
Hi there, if I order a given year in DESCending ORDER, so that the highest values (of a given variable) for the countries are displayed at the top of the list, then actually the NULL values appear as first. Only below, I find the values ordered correctly. Is there any way to a) make the

Re: [GENERAL] ORDER BY - problem with NULL values

2007-10-10 Thread Richard Huxton
Stefan Schwarzer wrote: Hi there, if I order a given year in DESCending ORDER, so that the highest values (of a given variable) for the countries are displayed at the top of the list, then actually the NULL values appear as first. Only below, I find the values ordered correctly. Is there any

Re: [GENERAL] Generating subtotal reports direct from SQL

2007-10-10 Thread Owen Hartnett
At 1:32 AM +0100 10/10/07, Gregory Stark wrote: Owen Hartnett [EMAIL PROTECTED] writes: Such that the final table has additional subtotal rows with the aggregate sum of the amounts. I'm thinking I can generate two tables and merge them, but is there an easier way using a fancy Select

Re: [GENERAL] replacing single quotes

2007-10-10 Thread Albe Laurenz
Ow Mun Heng wrote: Input is of form 'ppp','aaa','bbb' I want it to be stripped of quotes to become ppp,aaa,bbb The input is for an SRF which accepts an array.. where the function goes.. create function foo(timestamp, timestamp, foo_list text[]) returns setof ... I said: In

Re: [GENERAL] Upper and Lower-cased Database names?

2007-10-10 Thread Albe Laurenz
Daniel B. Thurman wrote: I am finding out for the first time that by having a database created with the name: MyTest, I cannot do a simple query as follows: postgres=# select * from MyTest.public.cars; ERROR: cross-database references are not implemented: mytest.public.cars Try: select

Re: [GENERAL] timer script from SAMS book or equivalent?

2007-10-10 Thread John Wells
Could someone explain to me how the connection is initialized below? I'm re-writing the script in Ruby...but this is a stumbling block for me in the way the C++ libs work. Does the library initial conn automagically? How would one emulate this in another language...would it be to run it as the

Re: [GENERAL] disjoint union types

2007-10-10 Thread Sam Mason
On Tue, Oct 09, 2007 at 10:30:15AM -0500, Erik Jones wrote: On Oct 9, 2007, at 9:38 AM, Sam Mason wrote: CREATE TABLE circle ( id SERIAL PRIMARY KEY, radius REAL NOT NULL ); CREATE TABLE square ( id SERIAL PRIMARY KEY, sidelen REAL NOT NULL ); CREATE TABLE shapes ( id SERIAL

Re: [GENERAL] ORDER BY - problem with NULL values

2007-10-10 Thread Rodrigo Gonzalez
Richard Huxton escribió: Stefan Schwarzer wrote: Hi there, if I order a given year in DESCending ORDER, so that the highest values (of a given variable) for the countries are displayed at the top of the list, then actually the NULL values appear as first. Only below, I find the values

Re: [GENERAL] pgodbc + Excel + msquery + background refresh

2007-10-10 Thread Scott Marlowe
On 10/10/07, Ow Mun Heng [EMAIL PROTECTED] wrote: Just wonder if anyone here uses Excel to connect to PG via ODBC. I'm using it extensively as my platform to get data from PG/MSSQL directly into excel. (Excel uses the msqry32.exe file which is like a stripped down sql query tool and returns

Re: [GENERAL] How to speedup intarray aggregate function?

2007-10-10 Thread Dmitry Koterov
I have written in C all needed contrib functions: intarray.bidx() (binary search in sorted list) and intagg.int_agg_append_state (bufferized appending of one array to another without linear memory reallocation). The speed now is great: in one case with intersection of 10 and 15000 arrays it

Re: [GENERAL] disjoint union types

2007-10-10 Thread Ian Barber
On 10/10/07, Sam Mason [EMAIL PROTECTED] wrote: On Tue, Oct 09, 2007 at 10:30:15AM -0500, Erik Jones wrote: On Oct 9, 2007, at 9:38 AM, Sam Mason wrote: CREATE TABLE circle ( id SERIAL PRIMARY KEY, radius REAL NOT NULL ); CREATE TABLE square ( id SERIAL PRIMARY KEY, sidelen REAL NOT

[GENERAL] Disable triggers per transaction 8.2.3

2007-10-10 Thread Henrik
Hello list, I wonder if it is possible to disable triggers for a single transaction. I know I can disable triggers per table but then I need to disable all triggers in all recursive tables before doing by query. Can I do: BEGIN TRANSACTION; DISABLE TRIGGERS; DELETE FROM tbl_foo WHERE ID 5;

Re: [GENERAL] disjoint union types

2007-10-10 Thread Sam Mason
On Wed, Oct 10, 2007 at 05:02:36PM +0100, Ian Barber wrote: I wonder if the best way to go would be to use the OO stuff. I don't see how the following is object orientated, but I'm not sure it matters much. If you had a shapes table, that had the various operations you were interested in (say

Re: [GENERAL] disjoint union types

2007-10-10 Thread Erik Jones
On Oct 10, 2007, at 11:42 AM, Sam Mason wrote: On Wed, Oct 10, 2007 at 05:02:36PM +0100, Ian Barber wrote: I wonder if the best way to go would be to use the OO stuff. I don't see how the following is object orientated, but I'm not sure it matters much. If you had a shapes table, that

[GENERAL] ALL( ... ) and ANY ( ... ) didn't behave as expected

2007-10-10 Thread Richard Broersma Jr
I expect that my intuition is incorrect about the use of ALL() and ANY(), but I found my result to be reverse from what I expected. Can anyone explain why ANY() behaves that way it does? Here are two test case examples that do what I expect: -- find all parent that only have boys SELECT *

Re: [GENERAL] ALL( ... ) and ANY ( ... ) didn't behave as expected

2007-10-10 Thread John D. Burger
Richard Broersma Jr wrote: Here is the example that doesn't do what I expect: --find all parents that have a mixture of boys and girls. --but this doesn't return anything SELECT * FROM Parents AS P WHERE 'girl' ALL ( SELECT gender FROM Children AS C1

Re: [GENERAL] ALL( ... ) and ANY ( ... ) didn't behave as expected

2007-10-10 Thread Richard Huxton
Richard Broersma Jr wrote: Here is the example that doesn't do what I expect: I'm guessing you're just stood too close to the problem. --find all parents that have a mixture of boys and girls. --but this doesn't return anything SELECT * FROM Parents AS P WHERE 'girl' ALL ( SELECT gender

Re: [GENERAL] ALL( ... ) and ANY ( ... ) didn't behave as expected

2007-10-10 Thread Erik Jones
On Oct 10, 2007, at 12:38 PM, Richard Broersma Jr wrote: I expect that my intuition is incorrect about the use of ALL() and ANY(), but I found my result to be reverse from what I expected. Can anyone explain why ANY() behaves that way it does? Here are two test case examples that do what

[GENERAL] preferred way to use PG_GETARG_BYTEA_P in SPI

2007-10-10 Thread Merlin Moncure
I'm curious what's considered the best way to invoke PG_GETARG_BYTEA_P in an SPI routine and properly check for null input in non 'strict' routines. Right now, I'm looking at PG_GETARG_POINTER to check for null value before using PG_GETARG_BYTEA_P to assign to the bytea pointer. ISTM a little

Re: [GENERAL] ALL( ... ) and ANY ( ... ) didn't behave as expected

2007-10-10 Thread Tom Lane
Richard Broersma Jr [EMAIL PROTECTED] writes: Can anyone explain why ANY() behaves that way it does? Aside from the responses already given, I'm wondering whether you have any NULL entries in Children.gender. NULL rows within a NOT IN subselect tend to produce confusing results ...

Re: [GENERAL] ALL( ... ) and ANY ( ... ) didn't behave as expected

2007-10-10 Thread Richard Broersma Jr
--- John D. Burger [EMAIL PROTECTED] wrote: I read this as: Find all parents such that none of their kids are girls and none of their kids are boys. That is, ALL of their genders are 'girl', AND ALL of their genders are 'boy'. Under the obvious assumptions about gender, the result is

Re: [GENERAL] time penalties on triggers?

2007-10-10 Thread Vivek Khera
On Oct 5, 2007, at 9:10 AM, Kenneth Downs wrote: I also found it very hard to pin down the penalty of the trigger, but came up with rough figures of 30-50% overhead. The complexity of the trigger did not matter. in which language did you write your triggers?

Re: [GENERAL] Disable triggers per transaction 8.2.3

2007-10-10 Thread Merlin Moncure
On 10/10/07, Henrik [EMAIL PROTECTED] wrote: Hello list, I wonder if it is possible to disable triggers for a single transaction. I know I can disable triggers per table but then I need to disable all triggers in all recursive tables before doing by query. Can I do: BEGIN TRANSACTION;

Re: [GENERAL] timer script from SAMS book or equivalent?

2007-10-10 Thread John Wells
My Ruby version is found below. Note it requires the postgres-pr ruby driver. Also note I didn't really ruby-ize it to much...for the most part it's a one-to-one translation. One different thing to note...this script expects you to have postgres-pr installed via rubygems. You can modify the

Re: [GENERAL] timer script from SAMS book or equivalent?

2007-10-10 Thread John Wells
Sorry...the first version was a bit rash and left out some features...particularly filtering by table. Here's the patch to correct: If anyone wants the corrected version, email me off list. Thanks, John # diff -w pg_timer_old.rb pg_timer.rb 18a19 app = File.basename $0 20,21c21,25

[GENERAL] PostgreSQL Conference Fall 2007, Registration closing soon!

2007-10-10 Thread Selena Deckelmann
PostgreSQL Conference Fall 2007 is a 1-day conference happening on October 20, 2007 on the beautiful Portland State University campus. PSU's Computer Science Graduate Student Council is graciously hosting an excellent group of speakers made up of prominent PostgreSQL consultants, developers and

[GENERAL] Default Ubuntu post-install Qs (PG v7.4)

2007-10-10 Thread Ralph Smith
1) Am I right when I assume an init.d type of start/kill scenario is used? 2) The ps -ef shows the process: /usr/lib/postgresql/7.4/postmaster -D /var/lib/postgresql/7.4/main postgres: stats buffer process postgres: stats collector process I see no logfile explicitly

Re: [GENERAL] preferred way to use PG_GETARG_BYTEA_P in SPI

2007-10-10 Thread Tom Lane
Merlin Moncure [EMAIL PROTECTED] writes: I'm curious what's considered the best way to invoke PG_GETARG_BYTEA_P in an SPI routine and properly check for null input in non 'strict' routines. Right now, I'm looking at PG_GETARG_POINTER to check for null value before using PG_GETARG_BYTEA_P to

[GENERAL] Coercing compound types to use generic ROW comparison operators

2007-10-10 Thread Randall Lucas
I am storing a rowtype that keeps the primary key column(s) of another table. E.g., create table point (x int, y int, stuff text, primary key (x, y)); then, think: create type point_pk as (x int, y int). When I go to compare point_pks against one another I get errors about missing

Re: [GENERAL] Default Ubuntu post-install Qs (PG v7.4)

2007-10-10 Thread Andrej Ricnik-Bay
On 10/11/07, Ralph Smith [EMAIL PROTECTED] wrote: 1) Am I right when I assume an init.d type of start/kill scenario is used? Aye 2) The ps -ef shows the process: /usr/lib/postgresql/7.4/postmaster -D /var/lib/postgresql/7.4/main postgres: stats buffer process postgres:

Re: [GENERAL] pgodbc + Excel + msquery + background refresh

2007-10-10 Thread Ow Mun Heng
On Wed, 2007-10-10 at 10:22 -0500, Scott Marlowe wrote: On 10/10/07, Ow Mun Heng [EMAIL PROTECTED] wrote: Just wonder if anyone here uses Excel to connect to PG via ODBC. I'm using it extensively as my platform to get data from PG/MSSQL directly into excel. (Excel uses the msqry32.exe

Re: [GENERAL] pgodbc + Excel + msquery + background refresh

2007-10-10 Thread Ow Mun Heng
On Wed, 2007-10-10 at 12:01 -0400, Gauthier, Dave wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:pgsql-general-[EMAIL PROTECTED] On Behalf Of Scott Marlowe Sent: Wednesday, October 10, 2007 11:23 AM To: Ow Mun Heng Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL]

[GENERAL] 8.2.4 selects make applications wait indefinitely

2007-10-10 Thread Carlos H. Reimer
Hi all, We are facing some problems after the migration of our PostgreSQL 8.0 to the 8.2.4 version. The entire box runs under SUSE 10.3. bd_sgp=# select version(); version

Re: [GENERAL] 8.2.4 selects make applications wait indefinitely

2007-10-10 Thread Tom Lane
Carlos H. Reimer [EMAIL PROTECTED] writes: ... if you name all the table columns instead of using the * the query runs fine, otherwise it locks. [ blink... ] You really, really, really need to provide a reproducible test case to prove that claim. The problem only occurs if we use remote

Re: [GENERAL] 8.2.4 selects make applications wait indefinitely

2007-10-10 Thread Erik Jones
On Oct 10, 2007, at 10:09 PM, Carlos H. Reimer wrote: Hi all, We are facing some problems after the migration of our PostgreSQL 8.0 to the 8.2.4 version. The entire box runs under SUSE 10.3. bd_sgp=# select version(); version

[GENERAL]silent install

2007-10-10 Thread longlong
hi all, msiexec /i D:\usr\local\postgre\postgresql-8.2-int.msi /qb INTERNALLAUNCH=1 ADDLOCAL=server,psql,docs SERVICEDOMAIN=%COMPUTERNAME% CREATESERICEUSER=1 BASEDIR=d:\usr\local\postgres SERVICEACCOUNT=postgres SERVICEPASSWORD=postgres SUPERPASSWORD=11 PERMITREMOTE=1 i try to the silent

[GENERAL] PLPGSQL 'SET SESSION ROLE' problems ..

2007-10-10 Thread Greg Wickham
Hi, Is it possible to change the current role to another arbitrary role using a PLPGSQL function? In essence I've a function authorise created by the db superuser with 'SECURITY DEFINER' specificied. However from within plpgsql the 'superuser' attribute isn't honored when trying to change

Re: [GENERAL] PLPGSQL 'SET SESSION ROLE' problems ..

2007-10-10 Thread Tom Lane
Greg Wickham [EMAIL PROTECTED] writes: Is it possible to change the current role to another arbitrary role using a PLPGSQL function? Yes. However from within plpgsql the 'superuser' attribute isn't honored when trying to change roles IIRC we deliberately restrict inheritance of superuser

[GENERAL] Not able to insert binary Data having NULL

2007-10-10 Thread Manish Jain
Hi, I have bytea column in one table and using C language, I am trying to insert a binary data (having NULLs) into bytea column, but it just inserts/updates till NULL reached. Please let know whether I am missing something. Any other approach - may I use some data type instead of