Re: [GENERAL] looping on NEW and OLD in a trigger

2010-08-28 Thread Merlin Moncure
On Sat, Aug 28, 2010 at 6:23 PM, Fabrízio de Royes Mello wrote: > 2010/8/28 Dmitriy Igrishin >> >> Hey Michael, >> >> As of PostgreSQL 9.0 you can do it from PL/pgSQL by >> using hstore module >> (http://www.postgresql.org/docs/9.0/static/hstore.html) >> >> I wrote an example for you: >> >> >> >

Re: [GENERAL] looping on NEW and OLD in a trigger

2010-08-26 Thread Merlin Moncure
On Thu, Aug 26, 2010 at 12:59 PM, Michael P. Soulier wrote: > On 26/08/10 Tom Lane did say: > >> If you're trying to do this in plpgsql, the answer is you can't. >> plpgsql doesn't support dynamic field references, which is what you'd >> need for what (I think) you're trying to do. >> >> You can d

Re: [GENERAL] How to convert a binary filed to an integer field?

2010-08-26 Thread Merlin Moncure
On Thu, Aug 26, 2010 at 1:47 PM, wrote: > I know what I need to do in the application for the change. My problem is > that I don't know a good process to make a such change in PostgreSQL. Since > the application is in production already, do I need to create another field > or convert the data

Re: [GENERAL] How to convert a binary filed to an integer field?

2010-08-26 Thread Merlin Moncure
On Thu, Aug 26, 2010 at 12:28 AM, wrote: > You are right. I typed the message in hurry before I left home this morning. > It is the boolean type. Thanks for your suggestion. The NULL value may not > work for jdbc. On the application level, a fixed set of constants is used to > represent the th

Re: [GENERAL] pg 9.0, streaming replication, fail over and fail back strategies

2010-08-18 Thread Merlin Moncure
On Mon, Aug 9, 2010 at 6:10 PM, Kyle R. Burton wrote: > Hello, > > I'm new to the list and not even sure if this is the right place to be > posting this... > > I've worked through the documentation for postgres 9.0 (beta2) and > have successfully set up a master and hot slave configured with > str

Re: [GENERAL] How-to question: pre-parsing and pre-planning dynamic sql statements

2010-08-11 Thread Merlin Moncure
On Wed, Aug 11, 2010 at 11:57 AM, Davor J. wrote: > On 11/08/2010 16:26, Merlin Moncure wrote: >> >> On Wed, Aug 11, 2010 at 8:35 AM, Davor J.  wrote: >> >>> >>> Suppose you have a table CREATE TABLE tbl_formulas (formula_id integer, >>> formula tex

Re: [GENERAL] How-to question: pre-parsing and pre-planning dynamic sql statements

2010-08-11 Thread Merlin Moncure
On Wed, Aug 11, 2010 at 8:35 AM, Davor J. wrote: > Suppose you have a table CREATE TABLE tbl_formulas (formula_id integer, > formula text) > > The formula field can be any postgres-supported mathematical operation which > references some input data with $1 like "sin($1) + cos($1)" and returns one

Re: [GENERAL] An aggregate function on ARRAY

2010-08-11 Thread Merlin Moncure
On Wed, Aug 11, 2010 at 8:42 AM, Rafal Pietrak wrote: > Hi, > > I've started using ARRAY data type recently, and I fell into the > following problem: > > When I have a relatively large ARRAY (like [1:500]) takeing an aggregate > function on its elements is not so easy. One has to iterate all the >

Re: [GENERAL] Is there a way to bypass sql?

2010-08-11 Thread Merlin Moncure
On Wed, Aug 11, 2010 at 1:31 AM, Samantha Atkins wrote: > > On Aug 9, 2010, at 11:57 AM, Merlin Moncure wrote: > >> On Mon, Aug 9, 2010 at 2:39 PM, samantha wrote: >>> I have been digging into NoSQL of late.  For navigational queries it would >>> be great if

Re: [GENERAL] RETURN QUERY SELECT & TYPE

2010-08-10 Thread Merlin Moncure
On Tue, Aug 10, 2010 at 2:27 AM, Pavel Stehule wrote: > Hello > > 2010/8/10 screamge : >> Here is code of first procedure: >> CREATE TYPE some_item AS >> (id integer, >> title character varying, >> ... >> ); >> >> >> CREATE OR REPLACE FUNCTION some_func (integer) RETURNS some_item AS >> ... >> ite

Re: [GENERAL] Is there a way to bypass sql?

2010-08-09 Thread Merlin Moncure
On Mon, Aug 9, 2010 at 2:39 PM, samantha wrote: > I have been digging into NoSQL of late.  For navigational queries it would > be great if there was a way to bypass SQL and directly pull from an > identifier for a record or arbitrary byte stream.  Does postgresql directly > support such ability?  

Re: [GENERAL] Danger of idiomatic plpgsql loop for merging data

2010-08-04 Thread Merlin Moncure
On Tue, Aug 3, 2010 at 11:32 PM, J. Greg Davidson wrote: > Hi fellow PostgreSQL hackers, > > First, a thank you to Merlin for commenting on my earlier post! > I've run into another dangerous problem since the earlier post. > > I began converting from the plpgsql loop idiom for merging data > into

Re: [GENERAL] Finding the primary key of tables

2010-08-03 Thread Merlin Moncure
2010/8/3 George Silva : > I'm going for Merlin's solution. Its the easiest one :P > > But I'm also having a problem: > > SELECT column_name FROM information_schema.key_column_usage k >     LEFT OUTER JOIN information_schema.table_constraints ON (k.table_name = > table_constraints.table_name) > WHER

Re: [GENERAL] Finding the primary key of tables

2010-08-03 Thread Merlin Moncure
On Tue, Aug 3, 2010 at 3:13 PM, George Silva wrote: > Hello guys, > > I'm building a function which needs to know what is the primary key of a > certain table (all in pgplsql). > > I was using select * from information_schema.key_column_usage where > table_schema='foo' and table_name = 'aaa'; but

Re: [GENERAL] Nodes and trees...

2010-08-03 Thread Merlin Moncure
On Tue, Aug 3, 2010 at 8:01 AM, Jason Schauberger wrote: > Dear fellow Postgres users, :-) > > please consider this table: > > CREATE TABLE nodes ( > > id      int     PRIMARY KEY, > > parent     int     REFERENCES nodes(id) > > ); > > In this table, each node *can* have a parent node. You can pic

Re: [GENERAL] select a list of column values directly into an array

2010-07-31 Thread Merlin Moncure
On Fri, Jul 30, 2010 at 11:50 AM, Merlin Moncure wrote: > On Fri, Jul 30, 2010 at 10:34 AM, Derrick Rice wrote: >> Is it possible to use the ARRAY(select ...) syntax as a substitute for >> array_agg on versions of postgresql that don't have it? (8.2)  It works >&g

Re: [GENERAL] select a list of column values directly into an array

2010-07-30 Thread Merlin Moncure
On Fri, Jul 30, 2010 at 10:34 AM, Derrick Rice wrote: > Is it possible to use the ARRAY(select ...) syntax as a substitute for > array_agg on versions of postgresql that don't have it? (8.2)  It works > simply enough when only selecting a single column, but if I need to group by > some other colum

Re: [GENERAL] Danger of idiomatic plpgsql loop for merging data

2010-07-29 Thread Merlin Moncure
On Thu, Jul 29, 2010 at 10:06 AM, Merlin Moncure wrote: > On Wed, Jul 28, 2010 at 5:27 PM, J. Greg Davidson wrote: >> Hi fellow PostgreSQL hackers, >> >> I just got burned by the idiomatic loop >> documented in the PostgreSQL manual as >> >> Example 39-2

Re: [GENERAL] Danger of idiomatic plpgsql loop for merging data

2010-07-29 Thread Merlin Moncure
On Wed, Jul 28, 2010 at 5:27 PM, J. Greg Davidson wrote: > Hi fellow PostgreSQL hackers, > > I just got burned by the idiomatic loop > documented in the PostgreSQL manual as > > Example 39-2. Exceptions with UPDATE/INSERT > > I have now replaced this "standard" idiom > with a safer one described b

Re: [GENERAL] Want FUNCTION to return argv[0] thru argv[6]

2010-07-28 Thread Merlin Moncure
On Wed, Jul 28, 2010 at 12:06 PM, Jerry Richards wrote: > Hello, > > I am using postgres-odbc and I created the following function which is > called from a C-application.  This function returns a single argv[0] of the > form "(a,b,c,d,e,f,g)". > > CREATE OR REPLACE FUNCTION PresRoute(int, int) RET

Re: [GENERAL] select a list of column values directly into an array

2010-07-27 Thread Merlin Moncure
On Tue, Jul 27, 2010 at 9:03 AM, Gauthier, Dave wrote: > Is there a way to select a list of column values directly into an array? > > create table foo (col1 text); > > insert into foo (col1) values (‘aaa’),(‘bbb’),(‘ccc’),(‘ddd’),(‘eee’); > > I’d like to load up an array with {aaa,bbb,ccc,ddd,eee}

Re: [GENERAL] Problem with pg_try_advisory_lock and two connections (seemingly) getting the same lock

2010-07-23 Thread Merlin Moncure
On Tue, Jul 20, 2010 at 10:52 PM, Craig Ringer wrote: > On 21/07/10 07:27, Brett Hoerner wrote: > >> Here is an example query, >> >> SELECT q.* >> FROM (SELECT id, job, arg >>       FROM queue >>       WHERE job = 'foo' OR job = 'bar' >>       OFFSET 0) AS q >> WHERE pg_try_advisory_lock(1, q.id)

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

2010-07-22 Thread Merlin Moncure
2010/7/22 Vinícius Soares : > Hey, > > thanks for your response. > I did it: > >     S8 sql[1500] = "insert into t values ( E'"; >         U8 *msg; >     msg = PQescapeByteaConn(conn, pending_cmd->cmd.value, > sizeof(msg_cmd_t), &to_length); >     for (i=0; i < sizeof(msg_cmd_t); i++){

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 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: *) encode the memory for

Re: [GENERAL] check_postgres reports most of my tables are unanalyzed for 8 weeks; why isn't autovacuum analyzing them?

2010-07-20 Thread Merlin Moncure
On Tue, Jul 20, 2010 at 4:31 PM, Aleksey Tsalolikhin wrote: > Hi.  I've just discovered the check_postgres utility and am running > all the tests against my database. > > The "last_analyze" test comes out critical - many tables unanalyzed > for 8 weeks. have those tables been modified at all? th

Re: [GENERAL] cache lookup failed for function 19119

2010-07-15 Thread Merlin Moncure
On Thu, Jul 15, 2010 at 2:34 AM, tamanna madaan wrote: > Hi All > > > > I am using  postgres-8.1.2 . > > And getting this error “cache lookup failed for function 19119”. > > Can anyone please let me know what could have gone wrong. > > How can a function go missing . And which function > > Its tal

Re: [GENERAL] Postgresql 8.4, XPath and name() function

2010-07-14 Thread Merlin Moncure
On Tue, Jul 13, 2010 at 4:03 AM, ced45 wrote: > > Hi List, > > I have trouble using XPath name() function in a XML field. > For example, when I execute the following query : > > SELECT XPATH('name(/*)', XMLPARSE(DOCUMENT 'value')) > > I would like to get "unit", but I just get an empty array ({}).

Re: [GENERAL] getting the last N tuples of a query

2010-07-12 Thread Merlin Moncure
On Thu, Jul 8, 2010 at 9:09 PM, Kenichiro Tanaka wrote: > Hello. > > I agree Ben. > But,I try your question as an SQL puzzle. > Doses this SQL meet what you want? > > select * from wantlast offset (select count(*)-10 from wantlast); that works, but for any non trivial query it's not optimal becau

Re: [GENERAL] optimizer choosing the wrong index

2010-07-08 Thread Merlin Moncure
On Thu, Jul 8, 2010 at 10:11 AM, Tom Lane wrote: > Martin Below writes: >> test=# select count(*) total, count(distinct client_id) ids, >> count(distinct expires_on) dates from ps; >>  total  |  ids   | dates >> ++ >>  213645 | 123366 | 213549 > > That says the expires_on

[GENERAL] I wonder what Postgres would be listed for?

2010-07-07 Thread Merlin Moncure
This page speaks for itself :D https://shop.oracle.com/pls/ostore/product?p1=berkeleydb&sc=ocom_berkeleydb merlin -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] make view with union return one record

2010-07-07 Thread Merlin Moncure
On Tue, Jul 6, 2010 at 3:43 PM, Andy Colson wrote: > I have gis data in layers, and a pin might appear in either layer, or both > (parcelPoly, parcelPoint), or neither (and I dont care which I find)... so I > have this view: > > > create view howardia.getPoint(shapeid, x, y, acres, pin, extent) as

Re: [GENERAL] optimizer choosing the wrong index

2010-07-07 Thread Merlin Moncure
On Wed, Jul 7, 2010 at 7:42 AM, Martin Below wrote: > Hello, > > I'm facing a strange problem where the optimizer does pick the wrong index. > Im using postgres 8.4, and my schema look like this: > >  client_id   | character varying(36)       | not null >  key         | character varying(16)      

Re: [GENERAL] moderninzing/upgrading mail list format

2010-07-06 Thread Merlin Moncure
On Tue, Jul 6, 2010 at 11:57 AM, Thom Brown wrote: > On 6 July 2010 16:50, John R Pierce wrote: >> On 07/05/10 2:43 PM, Dennis Gearon wrote: >>> >>> I belong to MANY email listservers, probably like all of us. >>> >>> All of them, I am on digest. >>> >> >> I quit using digests many years ago when

Re: [GENERAL] How to know if an INSERT is done inside a function?

2010-07-04 Thread Merlin Moncure
On Sun, Jul 4, 2010 at 7:25 AM, Andre Lopes wrote: > Great! That [begin exception end] is what I need! > > Thank you Pavel. > > Best Regards, Just a quick heads up: functions with exception handlers tend to be more expensive than those without, even if the exception doesn't fire. merlin -- Sen

Re: [GENERAL] change array dimension

2010-07-02 Thread Merlin Moncure
On Thu, Jul 1, 2010 at 7:32 PM, Gerhard Heift wrote: > Hello, > > is it possible to change the dimension of an array? I am looking for something > like this: > > SELECT change_array_dims('[1:2][1:2]', '{1,2,3,4}'::int[]); >  change_array_dims > --- >  {{1,2},{3,4}} > > and the othe

Re: [GENERAL] Problem with temporary tables

2010-06-30 Thread Merlin Moncure
On Wed, Jun 30, 2010 at 9:51 AM, Adrian Klaver wrote: > On Wednesday 30 June 2010 6:41:18 am Andrea Lombardoni wrote: >> > You need to use EXECUTE for the INSERT statement as well per error: >> > >> > CONTEXT:  SQL statement "INSERT INTO idmap (oldid, type, newid) VALUES(1, >> >  1, 1)" PL/pgSQL f

Re: [GENERAL] dropdb weirdness

2010-06-29 Thread Merlin Moncure
On Tue, Jun 29, 2010 at 4:04 PM, Geoffrey wrote: > So running the following command: > > dropdb -p 5443 swr > > I get: > > dropdb: could not connect to database postgres: FATAL:  database "postgres" > does not exist > > Why is it not 'seeing' the database name I'm passing to it?  Why is it > tryin

Re: [GENERAL] copy/duplicate database schemas

2010-06-23 Thread Merlin Moncure
On Wed, Jun 23, 2010 at 3:21 PM, Jamie Kahgee wrote: > I have an application in a schema and now i need to create other schemas b/c > the app needs to support different languages,  is there an easy way to copy > an entire schema to a new one (tables, contents, trigges, functions, etc..)? > right n

Re: [GENERAL] Problem Using RowType Declaration with Table Domains

2010-06-23 Thread Merlin Moncure
On Tue, Jun 22, 2010 at 12:26 AM, Tom Lane wrote: > "George Weaver" writes: >> I have the following (very simplified) scenario: > >> CREATE DOMAIN orderstatus AS text NOT NULL DEFAULT 'Open'; > >> CREATE TABLE orders ( orderno serial >>                                          , status orderstatu

Re: [GENERAL] postgres crash SOS

2010-06-18 Thread Merlin Moncure
On Fri, Jun 18, 2010 at 4:55 AM, Felde Norbert wrote: > Hi, > > This are the informations I could collect: > > > We use cobian to create the backup. > There are two volumes in use, on C is the volume where everything is > installed and here is the postgres data dir too. > The postgres backup that

Re: [GENERAL] postgres crash SOS

2010-06-17 Thread Merlin Moncure
On Thu, Jun 17, 2010 at 4:51 PM, Felde Norbert wrote: > The first error message was what I got after postgres crashed and I > tried to make a dump, run vacuum or tried somthing else. > The second message I got when I tried to repaire the problem, so it > dous not matter because I did something wro

Re: [GENERAL] postgres crash SOS

2010-06-17 Thread Merlin Moncure
On Thu, Jun 17, 2010 at 2:53 PM, Tom Lane wrote: > You weren't too specific about how you got into this state, but I > suppose that it must have been a system crash or power failure.  Even > then, you would not have gotten burnt if the filesystem and hardware > did what they're supposed to do.  I

Re: [GENERAL] postgres crash SOS

2010-06-17 Thread Merlin Moncure
On Thu, Jun 17, 2010 at 10:35 AM, Merlin Moncure wrote: > On Thu, Jun 17, 2010 at 4:47 AM, Felde Norbert wrote: >> Before I began I made a filesystem level backup after I stopped the >> postgres service. >> I have the original 0003 file, the size is 204800, The size of the &

Re: [GENERAL] oid data types mapping in libpq functions

2010-06-17 Thread Merlin Moncure
On Wed, Jun 16, 2010 at 10:42 PM, zhong ming wu wrote: > Dear List > > Where can I find this mapping of oid to pg data types mentioned in > libpq documentation? > Why is such information not mentioned in the documentation?  A general > knowledge? curious: what do you need the oids for? built in

Re: [GENERAL] postgres crash SOS

2010-06-17 Thread Merlin Moncure
On Thu, Jun 17, 2010 at 4:47 AM, Felde Norbert wrote: > Before I began I made a filesystem level backup after I stopped the > postgres service. > I have the original 0003 file, the size is 204800, The size of the > other files in this dir is 262144. hm...any indication of why the file is small? r

Re: [GENERAL] postgres crash SOS

2010-06-16 Thread Merlin Moncure
On Wed, Jun 16, 2010 at 7:55 PM, Felde Norbert wrote: > Hi all, > > I use 8.2 on a windows server 2008. > Suddenly postgres crashed and I can not do anything. The message is > Could not access status of transaction 3982736. > DATAIL: Could not read from file "pg_clog/0003" at offset 204800: No err

Re: [GENERAL] Is there a way to backup Postgres via SQL commands?

2010-06-14 Thread Merlin Moncure
On Mon, Jun 14, 2010 at 7:28 AM, Frank Church wrote: > Are there SQL commands that can do a backup over a client connection, > rather than from the command line like pgsql etc? > > By that I mean some kind of SELECT commands that can retrieve the > database's content as SQL commands that can be re

Re: [GENERAL] Hosting without pgcrypto functions. There are other solutions?

2010-06-14 Thread Merlin Moncure
On Sun, Jun 13, 2010 at 4:37 PM, Andre Lopes wrote: > Hi, > > I have an account in A2Hosting.com, and I'm developing some functions that > deal with encryption. > > A2Hosting.com don't have available the function "digest()" > > [code] > ERROR:  function digest(unknown, unknown) does not exist > LI

[GENERAL] 2010 eclipse community survey

2010-06-12 Thread Merlin Moncure
Primary Database: Postgres 11% Mysql 31.8% Oracle 21.6% I found the 2009 results: Postgres 9.9% Mysql 27.7% Oracle 27.3% Postgres beat out sql server. Of course, eclipse is heavily skewed towards java which is going to be very lightweight on the ms stack for obvious reasons. I think the main ta

Re: [GENERAL] Can ARRAY( ... ) generate text[][]?

2010-06-11 Thread Merlin Moncure
On Thu, Jun 10, 2010 at 6:59 PM, J. Greg Davidson wrote: > Hi fellow PostgreSQL hackers! > > I tried to write an SQL glue function to turn an array > of alternating key/value pairs into an array of arrays > and got the message > > ERROR:  42704: could not find array type for data type text[] I do

Re: [GENERAL] calculating distance between longitude and latitude

2010-06-10 Thread Merlin Moncure
On Wed, Jun 9, 2010 at 3:02 PM, Geoffrey wrote: > Does postgresql have functions to calculate the distance between two sets of > longitude and latitude. for posterity, if you are not: *) very interested in high performance (that is, ok w/sql implementation) *) needing super accurate results (ok w

Re: [GENERAL] Performance drop after upgrading to 8.4.4?

2010-06-08 Thread Merlin Moncure
On Thu, Jun 3, 2010 at 9:22 AM, Max Williams wrote: > Hi, > > I was doing some benchmarking while changing configuration options to try to > get more performance out of our postgresql servers and noticed that when > running pgbench against 8.4.3 vs 8.4.4 on identical hardware and > configuration t

Re: [GENERAL] pgbouncer

2010-06-03 Thread Merlin Moncure
On Thu, Jun 3, 2010 at 12:40 PM, Mario Ignacio Rodríguez Cortés wrote: > hello all: > > Well, i have a question if you know about this, i have a webserver in a > server and i have a database server, the question is: where should I > install the pgbouncer? in webserver, in database server or is the

Re: [GENERAL] PosttgreSQL on AIX

2010-06-02 Thread Merlin Moncure
On Wed, Jun 2, 2010 at 10:53 AM, Ernesto Quiñones wrote: > It's possible runs pgPool-II on AIX?? > It looks like it does. merlin -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] PosttgreSQL on AIX

2010-06-02 Thread Merlin Moncure
On Tue, Jun 1, 2010 at 8:39 PM, Ernesto Quiñones wrote: > How  many concurrence can support a server with 4 PPC Power 6 and 16GB RAM??!! > > I was thinking install the load balancing in this machine but maybe I > could run PostgreSQL in this machine without problems for my > concurrence For basic

Re: [GENERAL] hi, trying to compile postgres 8.3.11

2010-05-27 Thread Merlin Moncure
On Thu, May 27, 2010 at 10:42 AM, erobles wrote: > hi, > i tried to compile postgres 8.3.11 on SCO OpenServer 5.0.7, but ... when > the xlog.o is being compiled  i have the next error: > > /usr/tmp/ccihgiYL.s: 1113: syntax error at name f > /usr/tmp/ccihgiYL.s: 1113: syntax error at integer consta

Re: [GENERAL] Transaction with in function

2010-05-26 Thread Merlin Moncure
On Wed, May 26, 2010 at 2:52 AM, Ravi Katkar wrote: > How can we achieve nested transactions? ( may be using save points )with in > functions. > Is there any work around? It unfortunately can't be done from within the database. There is only one workaround -- using dblink or similar technology

Re: [GENERAL] why doesn't insert into foo delete from bar returning baz work?

2010-05-26 Thread Merlin Moncure
On Wed, May 26, 2010 at 11:17 AM, Palle Girgensohn wrote: > While you can do > > insert into foo (a, b) select a, b from bar; > > and > > delete from bar where a=1 returning a, b; > > it fails to run > > insert into foo (a, b) delete from bar where a=1 returning a, b; > > This is not what I would

Re: [GENERAL] Hiding data in postgresql

2010-05-24 Thread Merlin Moncure
On Mon, May 24, 2010 at 3:16 PM, Hector Beyers wrote: > > Hi guys, > does ANYONE have any tips on hiding data on a database server? This means > that data is stored in places that is not necessarily picked up in the > schema of the database. I am doing some research on databases and need some > di

Re: [GENERAL] returning ref cursor

2010-05-24 Thread Merlin Moncure
On Mon, May 24, 2010 at 1:44 AM, Ravi Katkar wrote: > Please let me know what’s wrong with below code > create or replace FUNCTION test_call() > > RETURNS VOID > >    AS $procedure$ > >    DECLARE > >    c_cursor  REFCURSOR; give your cursor a name: c_cursor REFCURSOR default 'a_name'; this nam

Re: [GENERAL] Alter column position

2010-05-22 Thread Merlin Moncure
On Sat, May 22, 2010 at 11:01 AM, Patrick Rutkowski wrote: > Though I do see how the performance bumps could be useful, I would still bet > that the huge majority of users who utters the words "damn, I wish I could > re-order columns" are just talking about the visual order in psql(1) or > PgAd

Re: [GENERAL] Select max(primary_key) taking a long time

2010-05-22 Thread Merlin Moncure
On Fri, May 21, 2010 at 1:48 PM, Francisco Reyes wrote: > Tom Lane writes: > >> Francisco Reyes writes: >>> >>> I am trying to do >>> select max(primary_key) from some_table; >> >> Are there a whole lot of nulls in that column? > > > Zero nulls. It is a primary key. do a big delete recently? an

Re: [GENERAL] Help reqd on azimuth finction

2010-05-22 Thread Merlin Moncure
On Sat, May 22, 2010 at 8:02 AM, Deepa Thulasidasan wrote: > Dear All, > > Can some one help me understand st_azimuth() available in postgis. did you read the documentation? (http://postgis.refractions.net/documentation/manual-svn/ST_Azimuth.html). the function calculates the angle between two p

Re: [GENERAL] getting all constraint violations

2010-05-21 Thread Merlin Moncure
On Fri, May 21, 2010 at 1:27 PM, Gauthier, Dave wrote: > Hi: > > > > I have a table with many constraints.  A user tries to insert a record that > violates many of them.  The error message I get back lists the first > violation. How cani I (or can I) get them all? the database stops processing af

Re: [GENERAL] appending items to record variable

2010-05-14 Thread Merlin Moncure
On Fri, May 14, 2010 at 9:12 AM, x y wrote: > Hi all > > In plpgsql, is there a way to append rows to a record variable? > > Each time a query like > SELECT mycolumn INTO myrecordvariable FROM ... > is executed, myrecordvariable seems to be reseted and previous entries are > lost. > > What I want

Re: [GENERAL] Avoiding surrogate keys

2010-05-04 Thread Merlin Moncure
On Tue, May 4, 2010 at 9:40 AM, Merlin Moncure wrote: > On Sat, May 1, 2010 at 4:14 PM, John R Pierce wrote: >> >> If your 'natural key' is a large text field, I'd have to assume there's some >> point at which a surrogate index would be more effic

Re: [GENERAL] Avoiding surrogate keys

2010-05-04 Thread Merlin Moncure
On Sat, May 1, 2010 at 4:14 PM, John R Pierce wrote: > > If your 'natural key' is a large text field, I'd have to assume there's some > point at which a surrogate index would be more efficient.  Would this be > above a few dozen characters, or a few 100 characters?   I wouldn't want a > PK based o

Re: [GENERAL] Native DB replication for PG

2010-05-03 Thread Merlin Moncure
On Mon, May 3, 2010 at 9:29 AM, Gauthier, Dave wrote: > So, back to the base note, as far as native replication support, I should > wait for v9 whic'll probably be out by the end of the summer? for 'native' replication waiting for 9.0 is your only option, because all of the other replication opt

Re: [GENERAL] PostgreSQL vs. Microsoft SQL server

2010-05-01 Thread Merlin Moncure
On Sat, May 1, 2010 at 2:47 PM, Thomas Løcke wrote: > Anybody know of any recent comparisons made between the two? > > I'm in the process of buying a new telephony related software suite, > and I'm getting mixed advice. Some say that MSSQL is _much_ > better/faster than PostgreSQL, and others say

Re: [GENERAL] Avoiding surrogate keys

2010-05-01 Thread Merlin Moncure
On Sat, May 1, 2010 at 12:09 PM, Lew wrote: > Philippe Lang wrote: >> >> I think nobody mentioned Object-Relational mappers. >> If you intend to used one (or think you may be using one in the future), >> using surrogate keys is more straightforward, if not necessary. > > Neither of those claims is

Re: [GENERAL] Native DB replication for PG

2010-04-30 Thread Merlin Moncure
On Fri, Apr 30, 2010 at 2:17 PM, Gauthier, Dave wrote: > I believe v9 will have native DB master/slave DB replication (correct if > wrong).  If so, what’s the best guess on when will v9 be released? well, depends on how you define replication, but yes. my _guess_ on release is late summer. the

Re: [GENERAL] Storing many big files in database- should I do it?

2010-04-29 Thread Merlin Moncure
On Thu, Apr 29, 2010 at 1:51 PM, David Wall wrote: > I missed the part that BYTEA was being used since it's generally not a good > way for starting large binary data because you are right that BYTEA requires > escaping across the wire (client to backend) both directions, which for true > binary da

Re: [GENERAL] Convert of string to array problem

2010-04-29 Thread Merlin Moncure
On Thu, Apr 29, 2010 at 8:52 AM, Thom Brown wrote: > On 29 April 2010 13:35, Bård Grønbech wrote: >> >> Have a string like '0.1;0.2;null;0.3' which I would like to convert >> into a double precision[] array. >> >> Trying: >> >> select cast (string_to_array('0.1;0.2;null;0.3', ';') as float8[]) >>

Re: [GENERAL] Problem: concat an array of arrays

2010-04-29 Thread Merlin Moncure
On Thu, Apr 29, 2010 at 8:46 AM, Merlin Moncure wrote: > On Wed, Apr 28, 2010 at 8:48 PM, Belka Lambda wrote: >> Hi! >> >> I tried to write a recursive SELECT, that would do the concatination, but a >> problem appeared: >> can't make a {1,2,3} from {

Re: [GENERAL] Problem: concat an array of arrays

2010-04-29 Thread Merlin Moncure
On Wed, Apr 28, 2010 at 8:48 PM, Belka Lambda wrote: > Hi! > > I tried to write a recursive SELECT, that would do the concatination, but a > problem appeared: > can't make a {1,2,3} from {{1,2,3}}. > Here are some experiments: >

Re: [GENERAL] Populate arrays from multiple rows

2010-04-28 Thread Merlin Moncure
On Wed, Apr 28, 2010 at 1:39 PM, wrote: > Good afternoon: > > I would like to insert some (1 or more) values from multiple rows of one > table into an array in another table. Here's the scenario: > > --table to house data provided by a third party > CREATE TABLE raw_foo ( >     rf_id serial P

Re: [GENERAL] How many threads/cores Postgres can utilise?

2010-04-28 Thread Merlin Moncure
On Wed, Apr 28, 2010 at 5:15 AM, Piotr Kublicki wrote: > Sorry to be a royal pain, but I cannot find it anywhere in the > documentation: how many threads/CPU cores Postgres v. 8.4 can utilise? > We're thinking about installing Postgres on a virtual machine (RedHat 5 > 64-bits), however not sure ho

Re: [GENERAL] PostgreSQL Performance issue

2010-04-27 Thread Merlin Moncure
On Tue, Apr 27, 2010 at 5:17 AM, Alban Hertroys wrote: > On 27 Apr 2010, at 10:11, > wrote: > >> Dear All Experts, >> >> I am using in PostgreSQL 8.3.5 database on windows 64 bit OS. >> However, I have a batch program written in Java which processes the data and >> populates them into tables i

Re: [GENERAL] Need help to identify stray row in a table

2010-04-23 Thread Merlin Moncure
2010/4/23 சிவகுமார் மா : > 2010/4/23 Merlin Moncure : >> >> You haven't given enough information to make any sort of reasonable >> diagnosis.  Most people are going to assume the problem is on your end >> but it's possible to know for sure without having the

Re: [GENERAL] Need help to identify stray row in a table

2010-04-23 Thread Merlin Moncure
2010/4/23 சிவகுமார் மா : > 1. We have a production system tracking value added to a batch through > series of stages. Value table is updated through triggers on  data > tables. > > 2. These trigger functions have been tested and validated for over 1.5 > years with more than 100,000 records. > > 3.

Re: [GENERAL] Avoiding surrogate keys

2010-04-21 Thread Merlin Moncure
On Wed, Apr 21, 2010 at 3:32 PM, Bill Moran wrote: > In response to "Joshua D. Drake" : > >> On Wed, 2010-04-21 at 15:07 -0400, Bill Moran wrote: >> > I'd use an ENUM for the status, as that's not liable to change. >> > >> > The only problem I see with avoiding the surrogate key for the country >>

Re: [GENERAL] Avoiding surrogate keys

2010-04-21 Thread Merlin Moncure
On Wed, Apr 21, 2010 at 3:01 PM, Thom Brown wrote: > I think I know what I plan to do, but want to throw this out there to see if > there are differing points of view. > I have a mailing list table, and 2 of the columns contain values which have > to be from a list.  These are country and status.

Re: [GENERAL] SELECT * in a view

2010-04-21 Thread Merlin Moncure
On Wed, Apr 21, 2010 at 2:14 PM, Andreas Kretschmer wrote: > Tom Lane wrote: > >> > That's not what I want.  That means that if old_view changes, new_view >> > will not reflect the changes.  Is there any way to get new_view to >> > automatically include all fields from old_view, no matter how man

Re: [GENERAL] SELECT * in a view

2010-04-21 Thread Merlin Moncure
On Wed, Apr 21, 2010 at 1:59 PM, Tom Lane wrote: > "Rob Richardson" writes: >> The old view and the new view should have the same fields.  So, I tried >> something like this: > >> CREATE VIEW new_view AS >>     SELECT * FROM old_view >>     WHERE complete = 1; > >> The query was accepted and the

Re: [GENERAL] How to insert Ecoded values into postrgresql

2010-04-19 Thread Merlin Moncure
On Thu, Apr 15, 2010 at 12:29 AM, Tom Lane wrote: > Bruce Momjian writes: >> Merlin Moncure wrote: >>> aside: anyone know if postgres properly handles csv according to rfc4180? > >> Wow, I had no idea there was an RFC for CSV. > > Me either.  I'd bet the p

Re: [GENERAL] How to call a file from a PlPgsql trigger?

2010-04-19 Thread Merlin Moncure
On Mon, Apr 19, 2010 at 5:13 AM, Andre Lopes wrote: > Ok, > > So the best option is to send the data to a table and then with an cronjob I > verify if it is data to send to the MySQL database. correct. this is the classic way of doing this type of work. merlin -- Sent via pgsql-general mailin

Re: [GENERAL] Tuple storage overhead

2010-04-16 Thread Merlin Moncure
On Fri, Apr 16, 2010 at 5:41 AM, Peter Bex wrote: > Hi all, > > I have a table with three columns: one integer and two doubles. > There are two indexes defined (one on the integer and one on one > of the doubles).  This table stores 70 records, which take up > 30 Mb according to pg_relation_si

Re: [GENERAL] How to insert Ecoded values into postrgresql

2010-04-15 Thread Merlin Moncure
On Thu, Apr 15, 2010 at 12:29 AM, Tom Lane wrote: > Bruce Momjian writes: >> Merlin Moncure wrote: >>> aside: anyone know if postgres properly handles csv according to rfc4180? > >> Wow, I had no idea there was an RFC for CSV. > > Me either.  I'd bet the p

Re: [GENERAL] How to insert Ecoded values into postrgresql

2010-04-14 Thread Merlin Moncure
On Wed, Apr 14, 2010 at 6:51 AM, venkat wrote: > Dear All, > >    How to insert encoded data that is(/\...@#$%^&*)(_+) something like > thatI have Csv file .Which contains encoded values.when i try to insert > those. I am getting error..I am not able to insert encoded data.Please > anyone guid

Re: [GENERAL] C-language functions: SRF question

2010-04-08 Thread Merlin Moncure
On Thu, Apr 8, 2010 at 11:40 AM, Jorge Arevalo wrote: > Is this a good way of doing it? Is it possible? And another small > question: if the memory for my array of structs is allocated inside > the function that provides me the array, should I deallocate it in the > SRF? Using pfree? It wasn't all

Re: [GENERAL] Solid State Drives with PG

2010-04-07 Thread Merlin Moncure
On Wed, Apr 7, 2010 at 3:27 PM, Vick Khera wrote: > On Fri, Mar 26, 2010 at 3:50 PM, Merlin Moncure wrote: >> here is a _used_ 320gb ramsan for 15k :-).  dram storage is pricey. >> > > I think using DRAM as the base is way better than flash.  Just use the > flash or a re

Re: [GENERAL] cursors from pl/pgsql

2010-04-07 Thread Merlin Moncure
On Tue, Apr 6, 2010 at 9:58 PM, Marc Menem wrote: > Hi all, > > I'm trying to use a cursor returned by a function from another function. But > I can't seem to get it working correctly. The error message is: >   ERROR:  cursor FOR loop must use a bound cursor variable > I am not sure how to bind it

Re: [GENERAL] Connection Pooling

2010-04-06 Thread Merlin Moncure
On Tue, Apr 6, 2010 at 1:09 PM, David Kerr wrote: > On Mon, Apr 05, 2010 at 10:44:53PM -0400, Merlin Moncure wrote: > - pgbouncer is totally transparent.  I manage quite a few databases and > - I use it (w/session mode) so I can psql to a single host (localhost), > - and bounce betwe

Re: [GENERAL] Connection Pooling

2010-04-05 Thread Merlin Moncure
On Mon, Apr 5, 2010 at 4:36 PM, David Kerr wrote: > On Sat, Apr 03, 2010 at 09:32:25PM -0400, Merlin Moncure wrote: > - > - I have a lot of respect for pgbouncer (haven't used pgpool).  One > - possible way to do what you're thinking is to rotate the pool on user. > -

Re: [GENERAL] count function alternative in postgres

2010-04-05 Thread Merlin Moncure
On Sat, Apr 3, 2010 at 3:02 PM, Scott Bailey wrote: > junaid malik wrote: >> >> Is there any alternative of mysql function COUNT(DISTINCT expr, >> [expr...]) in postgres. We get error if we >> >> write count like this count(distinct profile.id, profile.name, >> profile.age) but it works well in my

Re: [GENERAL] How to fix set-valued function called in context that cannot accept a set in earlier versions

2010-04-05 Thread Merlin Moncure
On Mon, Apr 5, 2010 at 7:28 AM, hubert depesz lubaczewski wrote: > On Mon, Apr 05, 2010 at 02:14:33PM +0300, Andrus wrote: >> select wordwrap('fdgdf',10) > > select * from wordwrap('...', ...); another workaround is to wrap the pl/pgsql function in sql function. it's not always easy to re-work th

Re: [GENERAL] Connection Pooling

2010-04-03 Thread Merlin Moncure
On Fri, Mar 26, 2010 at 5:17 PM, David Kerr wrote: > Howdy all, > > I have some apps that are connecting to my DB via direct JDBC and I'd like to > pool their connections. > > I've been looking at poolers for a while, and pgbouncer and pgpool-ii seem to > be some of the most popular, so > i've s

Re: [GENERAL] transaction control in pl/pgsql

2010-04-01 Thread Merlin Moncure
On Thu, Apr 1, 2010 at 6:22 AM, Birgit Laggner wrote: > Dear list, > > I have some data (big size) and I've written a long function in pl/pgsql > which processes the data in several steps. At a test run my function > aborted because of memory exhaustion. My guess is, that everything what > happens

Re: [GENERAL] Dblink vs calling a function that returns void

2010-03-30 Thread Merlin Moncure
On Mon, Mar 29, 2010 at 12:12 PM, Tom Lane wrote: > Boszormenyi Zoltan writes: >> I need to call a function via dblink that returns a void, i.e. >> technically nothing. > > You're overthinking the problem.  Imagine void is just a datatype > (which it is...)  This should work: but it isn't! void

Re: [GENERAL] Processor speed relative to postgres transactions per second

2010-03-30 Thread Merlin Moncure
On Mon, Mar 29, 2010 at 12:42 PM, Chris Barnes wrote: > > We have two camps that think that the speed of cpu processors is/aren't > relative to the number of transactions that postgres that can performed per > second. > > I am of the opinion that is we throw the faster processors at the database >

<    8   9   10   11   12   13   14   15   16   17   >