Re: [GENERAL] what do i need to know about array index?

2010-07-21 Thread Prometheus Prometheus
Date: Wed, 21 Jul 2010 12:38:55 +0800 From: cr...@postnewspapers.com.au To: prometheus...@hotmail.com CC: pgsql-general@postgresql.org Subject: Re: [GENERAL] what do i need to know about array index? On 20/07/10 18:27, Prometheus Prometheus wrote: What's with the pseudonym? nothing

Re: [GENERAL] what do i need to know about array index?

2010-07-21 Thread Craig Ringer
On 21/07/10 15:08, Prometheus Prometheus wrote: head - wall That's about how I feel about SQL NULLs in general. They seem like a great idea. A way of representing unknown or undefined in a generic, consistent manner. Or is that a definite value that means empty or absent ? Depends on who you

[GENERAL] Bitmask trickiness

2010-07-21 Thread Howard Rogers
Suppose 1=Red, 2=Yellow, 4=Green and 8=Orange. Now suppose the following data structures and rows exist: create table coloursample (recid integer, colour integer, descript varchar); insert into coloursample values (1,2,'Yellow only'); insert into coloursample values (2,10,'Yellow and Orange');

Re: [GENERAL] INSERT RETURNING and partitioning

2010-07-21 Thread pdov...@tiscali.it
Hi, I'm testing the system with these two insert commands: 1) this command returns an empty result set: insert into support.master (a) VALUES (2) RETURNING seq; 2) this command returns correctly the seq (serial) value into result set: insert into support.partitionB (a) VALUES (2) RETURNING seq;

Re: [GENERAL] Bitmask trickiness

2010-07-21 Thread Scott Marlowe
On Tue, Jul 20, 2010 at 9:59 PM, Howard Rogers h...@diznix.com wrote: Suppose 1=Red, 2=Yellow, 4=Green and 8=Orange. Now suppose the following data structures and rows exist: create table coloursample (recid integer, colour integer, descript varchar); insert into coloursample values

Re: [GENERAL] INSERT RETURNING and partitioning

2010-07-21 Thread Jan Otto
hi, On Jul 21, 2010, at 10:02, pdov...@tiscali.it pdov...@tiscali.it wrote: Hi, I'm testing the system with these two insert commands: 1) this command returns an empty result set: insert into support.master (a) VALUES (2) RETURNING seq; 2) this command returns correctly the seq (serial)

Re: [GENERAL] Bitmask trickiness

2010-07-21 Thread Yeb Havinga
Howard Rogers wrote: insert into coloursample values (2,10,'Yellow and Orange'); But how do I find records which are ONLY yellow and orange what about select * from coloursample where colour = 10; regards, Yeb Havinga -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org)

Re: [GENERAL] INSERT RETURNING and partitioning

2010-07-21 Thread Thom Brown
On 21 July 2010 09:17, Jan Otto as...@me.com wrote: hi, On Jul 21, 2010, at 10:02, pdov...@tiscali.it pdov...@tiscali.it wrote: Hi, I'm testing the system with these two insert commands: 1) this command returns an empty result set: insert into support.master (a) VALUES (2) RETURNING seq;

Re: [GENERAL] Bitmask trickiness

2010-07-21 Thread Stephen Cook
On 7/20/2010 11:59 PM, Howard Rogers wrote: But how do I find records which are ONLY yellow and orange, and exclude records which have some other colour mixed in, in one simple query without a lot of 'not this, not that' additions, and without using multiple separate AND tests to nail it down?

Re: [GENERAL] INSERT RETURNING and partitioning

2010-07-21 Thread pdov...@tiscali.it
Hi Jan, Messaggio originale Da: as...@me.com Data: 21/07/2010 10.17 A: pdov...@tiscali.itpdov...@tiscali.it Cc: pgsql-general@postgresql.orgpgsql-general@postgresql.org Ogg: Re: [GENERAL] INSERT RETURNING and partitioning hi, On Jul 21, 2010, at 10:02, pdov...@tiscali.it

Re: [GENERAL] INSERT RETURNING and partitioning

2010-07-21 Thread pdov...@tiscali.it
Hi Tom Messaggio originale Da: thombr...@gmail.com Data: 21/07/2010 10.38 A: Jan Ottoas...@me.com Cc: pdov...@tiscali.itpdov...@tiscali.it, pgsql- gene...@postgresql.orgpgsql-general@postgresql.org Ogg: Re: [GENERAL] INSERT RETURNING and partitioning On 21 July 2010 09:17, Jan Otto

Re: [GENERAL] INSERT RETURNING and partitioning

2010-07-21 Thread Alban Hertroys
On 21 Jul 2010, at 11:35, pdov...@tiscali.it wrote: Yes, Jan's right. You're effectively overriding the return values with NULL. Although I think I know why you're doing it, because you want to redirect the value to the child table so that it doesn't get inserted into the parent table as

[GENERAL] Oracle Spatial and PostGis

2010-07-21 Thread Szymon Guz
Hi, when I have an Oracle spatial database, I can easily convert it to PostgreSQL database, using handwritten tool, or just dumping it to a shape file and loading to the PostGis database. Do you know any simple way for (semi)automatical conversion of the spatial queries from Oracle to PostGis? I

[GENERAL] pg_dump-restore concurrency

2010-07-21 Thread paladine
Hi all I prefer doing pg_dump - psql restore to vacuum full and is there anyone know whether postgresql can insert data concurrently while restoring a table for not losing any data. thanks in advance... -- View this message in context:

Re: [GENERAL] pg_dump-restore concurrency

2010-07-21 Thread Craig Ringer
On 21/07/10 19:26, paladine wrote: Hi all I prefer doing pg_dump - psql restore to vacuum full and is there anyone know whether postgresql can insert data concurrently while restoring a table for not losing any data. There's no particular reason why you can't just feed a data-only dump

Re: [GENERAL] pg_dump-restore concurrency

2010-07-21 Thread paladine
I have a linux daemon that parses some datas and writes to db continuously but my db is growing unexpectedly so I must reduce disk space once a week. vacuum full is one solution but pg_dump-restore gives back more space to OS. I wrote a script like this # pg_dump db asd.sql (1) # dropdb db

[GENERAL] locating cities within a radius of another

2010-07-21 Thread Geoffrey
We need to locate all cities within a certain distance of a single city. We have longitude and latitude data for all cities. I was thinking postGIS was a viable solution, but I don't see a way to use our existing data via postGIS. Is postGIS a viable solution, or should I be looking at a

Re: [GENERAL] Insert and Retrieve unsigned char sequences using C

2010-07-21 Thread Merlin Moncure
On Mon, Jul 19, 2010 at 8:14 PM, vinicius_bra vinicius...@yahoo.com.br wrote: Hi All, I'm developing a system in C and I have a unsigned char pointer that represents a struct and I like to store it in a bytea column in postgreSQL. How can I do it? Example: you have several options: *)

Re: [GENERAL] Oracle Spatial and PostGis

2010-07-21 Thread Martin Gainty
take Oracle Spatial SDO_FILTER Functio Uses the spatial index to identify either the set of spatial objects that are likely to interact spatially with a given object Format: SDO_FILTER(geometry1, geometry2, params); http://download.oracle.com/docs/html/A85337_01/sdo_oper.htm#76214

Re: [GENERAL] transactions within stored procedures

2010-07-21 Thread Robot Tom
Hi, Has there been any progress on nested transactions in the last 10 years? I am in a situation where I have a script that executes a number of functions that build and populate a database including a rather large lookup table (80GB) along with a number of large indexes (10GB). I am trying

Re: [GENERAL] locating cities within a radius of another

2010-07-21 Thread Andy Colson
On 7/21/2010 8:01 AM, Geoffrey wrote: We need to locate all cities within a certain distance of a single city. We have longitude and latitude data for all cities. I was thinking postGIS was a viable solution, but I don't see a way to use our existing data via postGIS. Is postGIS a viable

Re: [GENERAL] transactions within stored procedures

2010-07-21 Thread Peter Geoghegan
On 21 July 2010 10:43, Robot Tom robotwil...@googlemail.com wrote: Hi, Has there been any progress on nested transactions in the last 10 years? PostgreSQL has had subtransactions since version 8.0, if that's what you mean. If you're experiencing OOM a lot, a high work_mem setting is often the

Re: [GENERAL] locating cities within a radius of another

2010-07-21 Thread Joe Conway
On 07/21/2010 06:01 AM, Geoffrey wrote: We need to locate all cities within a certain distance of a single city. We have longitude and latitude data for all cities. I was thinking postGIS was a viable solution, but I don't see a way to use our existing data via postGIS. Is postGIS a

[GENERAL] text vs. varchar

2010-07-21 Thread Ben Chobot
Is there any difference between text and varchar data types? (Not varchar(n), just varchar.) I can't see a different from the manual page, but I'm wondering about index usage or something similarly subtle. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to

Re: [GENERAL] text vs. varchar

2010-07-21 Thread Joshua D. Drake
On Wed, 2010-07-21 at 08:58 -0700, Ben Chobot wrote: Is there any difference between text and varchar data types? (Not varchar(n), just varchar.) I can't see a different from the manual page, but I'm wondering about index usage or something similarly subtle. They are the same thing. So is

Re: [GENERAL] text vs. varchar

2010-07-21 Thread Peter C. Lai
varchar allows you to define an explicit length of the field, text does not. varchar with a length specified (varchar(n)) is sql92 compliant while varchar() and text are pgsql extensions. On 2010-07-21 08:58:54AM -0700, Ben Chobot wrote: Is there any difference between text and varchar data

Re: [GENERAL] text vs. varchar

2010-07-21 Thread Thom Brown
On 21 July 2010 16:58, Ben Chobot be...@silentmedia.com wrote: Is there any difference between text and varchar data types? (Not varchar(n), just varchar.) I can't see a different from the manual page, but I'm wondering about index usage or something similarly subtle. -- Here's what Tom

Re: [GENERAL] text vs. varchar

2010-07-21 Thread Ben Chobot
On Jul 21, 2010, at 9:05 AM, Thom Brown wrote: On 21 July 2010 16:58, Ben Chobot be...@silentmedia.com wrote: Is there any difference between text and varchar data types? (Not varchar(n), just varchar.) I can't see a different from the manual page, but I'm wondering about index usage or

Re: [GENERAL] locating cities within a radius of another

2010-07-21 Thread Pierre Racine
Once PostGIS is installed you can do it with a single SQL query looking like this: SELECT dest.id, ST_Distance(ST_MakePoint(orig.longitude, orig.latitude), ST_MakePoint(dest.longitude, dest.latitude)) FROM yourcitytable orig, yourcitytable dest WHERE ST_DWithin(ST_MakePoint(orig.longitude,

Re: [GENERAL] pg_dump-restore concurrency

2010-07-21 Thread Chris Browne
yasinma...@gmail.com (paladine) writes: Hi all I prefer doing pg_dump - psql restore to vacuum full and is there anyone know whether postgresql can insert data concurrently while restoring a table for not losing any data. thanks in advance... The problem scenario that I'd expect is with

Re: [GENERAL] locating cities within a radius of another

2010-07-21 Thread Paul Ramsey
create table cities ( geog geography, name varchar, id integer primary key ); insert into cities select Geography(ST_SetSRID(ST_MakePoint(lon, lat),4326)) as geog, name, id from mytable; create index cities_gix on cities using gist ( geog ); select st_distance(a.geog, b.geog),

Re: [GENERAL] locating cities within a radius of another

2010-07-21 Thread Pierre Racine
Hum right... Better follow Paul instructions. We are in geographic coordinates here... Sorry. This would work in a limited projected space. -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Pierre Racine Sent: 21 juillet

Re: [GENERAL] Bitmask trickiness

2010-07-21 Thread Howard Rogers
On Wed, Jul 21, 2010 at 9:17 PM, Mathieu De Zutter math...@dezutter.org wrote: On Wed, Jul 21, 2010 at 5:59 AM, Howard Rogers h...@diznix.com wrote: It's also easy to find records which have either some yellow or some orange (or both) in them: select * from coloursample where colour 100;

Re: [GENERAL] pg_dump-restore concurrency

2010-07-21 Thread Craig Ringer
On 21/07/10 20:21, paladine wrote: I have a linux daemon that parses some datas and writes to db continuously but my db is growing unexpectedly so I must reduce disk space once a week. I assume you're also deleting from the database, given that its growth is a problem. It sounds like you

Re: [GENERAL] Bitmask trickiness

2010-07-21 Thread Scott Marlowe
On Wed, Jul 21, 2010 at 4:41 AM, Howard Rogers h...@diznix.com wrote: On Wed, Jul 21, 2010 at 6:08 PM, Scott Marlowe scott.marl...@gmail.com wrote: On Tue, Jul 20, 2010 at 9:59 PM, Howard Rogers h...@diznix.com wrote: Suppose 1=Red, 2=Yellow, 4=Green and 8=Orange. Now suppose the following

Re: [GENERAL] Bitmask trickiness

2010-07-21 Thread Scott Marlowe
On Wed, Jul 21, 2010 at 9:02 PM, Scott Marlowe scott.marl...@gmail.com wrote: If the fifth bit means one thing, and the 7th bit means something else, quick which of the following have the fifth bit set and the 7th bit off: That should be fifth bit off and 7th bit on up there ^^^ 01001101