[GENERAL] returning dynamic record

2007-11-06 Thread nick
Just wondering, if it is possible to do the following create function foo() RETURNS Record(int, varchar, int) then inside of the function return a set int, varchar, int. Then be able to call the function select * From foo() instead of having to write select * from foo() as (int, varchar, int

Re: [GENERAL] It it possible to get this result in one query?

2010-10-14 Thread Nick
... 1 | new one | [table_one,table_three] 2 | new two | [table_two,table_three] 3 | three | [table_three] On Oct 14, 4:49 pm, Nick wrote: > Is it possible to get the results of this snip of a function without > using a function? All tables include an id and title column. > > tables := ARR

[GENERAL] It it possible to get this result in one query?

2010-10-14 Thread Nick
Is it possible to get the results of this snip of a function without using a function? All tables include an id and title column. tables := ARRAY[table_one,table_two,table_three]::VARCHAR; CREATE TEMP TABLE final_results (id INTEGER, title VARCHAR, r_types VARCHAR[]); FOR t IN ARRAY_LOWER(tables,1

Re: [GENERAL] It it possible to get this result in one query?

2010-10-14 Thread Nick
Found a solution for what I need. Please let me know if you know of something better/faster. -Nick CREATE AGGREGATE array_accum (anyelement) ( sfunc = array_append, stype = anyarray, initcond = '{}' ); SELECT id, title, array_accum(t) AS ts FROM ( SELECT 'table_one&#

Re: [GENERAL] It it possible to get this result in one query?

2010-10-15 Thread Nick
Thanks Guy, is it possible to get the 3rd column result as an array instead of string? -Nick On Oct 14, 9:27 pm, guyr-...@burntmail.com (Guy Rouillier) wrote: > Sure: > > select >     t3.id, >     coalesce >        ( >        t1.title, >        t2.

[GENERAL] Thoughts on a surrogate key lookup function?

2010-11-06 Thread Nick
Are there any existing trigger functions (preferably C) that could retrieve a missing value for a compound foreign key on insert or update? If this overall sounds like a really bad idea, please let me know as well. This functionality could really speed my project up though. For example, CREATE TA

Re: [GENERAL] Thoughts on a surrogate key lookup function?

2010-11-06 Thread Nick
) RETURNING id INTO NEW.last_name_id So by adding both the surrogate and natural keys to users table and toggling the surrogate on insert by 0 (must exist) or -1 (select or insert) I can bypass a much more complex insert statement. Is this frowned upon? I havent had many issues (but some ive been a

[GENERAL] Creating a VIEW with a POINT column

2008-06-26 Thread Nick
I have a VIEW that consists of two tables, of which contain a POINT column. When trying to select from the view I get an error... ERROR: could not identify an ordering operator for type point HINT: Use an explicit ordering operator or modify the query. Any suggestions??? -Nick -- Sent via

[GENERAL] Join tables by nearest date?

2009-07-27 Thread Nick
Is it possible to join two tables by the nearest date? For example how could I find out where the user was on their birthday? users (id, name, birthday) 1 | one | 2009-07-27 2 | two | 2009-07-28 3 | three | 2009-07-29 4 | four | 2009-07-30 5 | five | 2009-07-31 users_locations (id, user_id, creat

[GENERAL] Get most recent message between users?

2009-08-17 Thread Nick
messages (id, to_user, from_user, created) 1 | 1 | 2 | 2009-05-21 2 | 1 | 3 | 2009-06-21 3 | 1 | 4 | 2009-07-21 4 | 2 | 1 | 2009-05-10 5 | 2 | 3 | 2009-06-10 6 | 1 | 2 | 2009-07-10 How could I get the most recent message between two users? -- Sent via pgsql-general mailing list (pgsql-general@po

Re: [GENERAL] Get most recent message between users?

2009-08-17 Thread nick
...@pinpointresearch.com (Steve Crawford) wrote: > Nick wrote: > > messages (id, to_user, from_user, created) > > 1 | 1 | 2 | 2009-05-21 > > 2 | 1 | 3 | 2009-06-21 > > 3 | 1 | 4 | 2009-07-21 > > 4 | 2 | 1 | 2009-05-10 > > 5 | 2 | 3 | 2009-06-10 > > 6 | 1 | 2 | 200

[GENERAL] Regex substring help

2009-09-03 Thread Nick
Im trying to get all the text before the '' tag. SELECT SUBSTRING('onetwothree','(^.*).*$'); returns "onetwo" How do I get it to return "one"? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-ge

[GENERAL] Return 30% of results?

2009-09-18 Thread Nick
Is there a way to return a percentage of the rows found? I tried window functions but get an error... ERROR: syntax error at or near "OVER" SELECT id, cume_dist FROM ( SELECT id, cume_dist() OVER (ORDER BY id) FROM employees ) s WHERE cume_dist < 0.3 -- Sent via pgsql-general mailing list (p

Re: [GENERAL] Return 30% of results?

2009-09-19 Thread nick
On Sep 18, 3:40 pm, spam_ea...@gmx.net (Thomas Kellerer) wrote: > Nick wrote on 18.09.2009 23:31:> Is there a way to return a percentage of the > rows found? I tried > > window functions but get an error... > > > ERROR:  syntax error at or near "OVER&quo

[GENERAL] Access dynamic NEW.column_name in trigger?

2009-10-09 Thread Nick
This is a very abbr version of my problem, but what would be the best way to do this... DECLARE column_name_var TEXT; BEGIN RETURN NEW.column_name_var; END; -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/

[GENERAL] What's wrong with this regexp?

2009-10-10 Thread Nick
SELECT TRUE WHERE '/steps/?step=10' ~ '^\/steps\/\?step=10$' Im guessing its an escape issue, but where am I going wrong? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Inserting boolean types as an alias?

2013-12-02 Thread Nick
Hello I am new to this site and also a student. I am working on an assignment and was wondering if there is a way to make an alias for a boolean? For example when I am making a table called club_games and it must contain the memberID, gameID, count, and status as column fields. When I enter the dat

Re: [GENERAL] Return equal number of rows with same column value

2012-06-04 Thread Nick
On Jun 4, 5:27 pm, Nick wrote: > For the data... > > INSERT INTO test (id,val) VALUES (1,a); > INSERT INTO test (id,val) VALUES (2,a); > INSERT INTO test (id,val) VALUES (3,a); > INSERT INTO test (id,val) VALUES (4,a); > INSERT INTO test (id,val) VALUES (5,b); > INSERT I

[GENERAL] Return equal number of rows with same column value

2012-06-04 Thread Nick
For the data... INSERT INTO test (id,val) VALUES (1,a); INSERT INTO test (id,val) VALUES (2,a); INSERT INTO test (id,val) VALUES (3,a); INSERT INTO test (id,val) VALUES (4,a); INSERT INTO test (id,val) VALUES (5,b); INSERT INTO test (id,val) VALUES (6,b); How could I return an even amount of val?

Re: [GENERAL] High CPU on read-only streaming replication server

2012-07-19 Thread Nick
On Jul 19, 1:23 pm, Nick wrote: > My read-only streaming replication servers are showing a much higher > CPU load than I would expect. > > None of my queries are longer than 10ms. > > My application server is connecting to this server via pgbouncer. > > Other than tha

Re: [GENERAL] High CPU on read-only streaming replication server

2012-07-20 Thread Nick
BTW, Its version 9.1.4 on a 2.2Ghz dual processor with 17GB of ram. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] High CPU on read-only streaming replication server

2012-07-20 Thread Nick
My read-only streaming replication servers are showing a much higher CPU load than I would expect. None of my queries are longer than 10ms. My application server is connecting to this server via pgbouncer. Other than that, its a pretty standard setup. I haven't toyed with too many settings besid

[GENERAL] At what point does a big table start becoming too big?

2012-08-22 Thread Nick
I have a table with 40 million rows and haven't had any performance issues yet. Are there any rules of thumb as to when a table starts getting too big? For example, maybe if the index size is 6x the amount of ram, if the table is 10% of total disk space, etc? -- Sent via pgsql-general mailing

[GENERAL] Find users that have ALL categories

2010-06-30 Thread Nick
Is this the most efficient way to write this query? Id like to get a list of users that have the categories 1, 2, and 3? SELECT user_id FROM user_categories WHERE category_id IN (1,2,3) GROUP BY user_id HAVING COUNT(*) = 3 users_categories (user_id, category_id) 1 | 1 1 | 2 1 | 3 2 | 1 2 | 2 3 |

Re: [GENERAL] On insert duplicate row, return existing key

2010-08-04 Thread Nick
Anyone? Please On Jul 31, 12:36 pm, Nick wrote: > If I insert a duplicate row into a table, id like to return the > existing key. > > I tried creating a rule for this... > > CREATE RULE no_duplicates AS ON INSERT TO names WHERE EXISTS (SELECT 1 > FROM names WHERE new.na

[GENERAL] Dynamically update NEW columns in plpgsql trigger

2010-09-08 Thread Nick
I need to dynamically update NEW columns. Ive been inserting the NEW values into a temp table, updating them, then passing the temp table values back to NEW (is there a better way?). Ive had success with this method unless there is a null value... EXECUTE 'CREATE TEMP TABLE new AS SELECT $1.*' USI

Re: [GENERAL] Dynamically update NEW columns in plpgsql trigger

2010-09-09 Thread Nick
On Sep 9, 2:21 am, dmit...@gmail.com (Dmitriy Igrishin) wrote: > Hey Nick, > > You may do it with PL/pgSQL more easily with hstore module. > Please, refer tohttp://www.postgresql.org/docs/9.0/static/hstore.html > Please, look at the hstore(record) and populate_record(record, hst

[GENERAL] Regular expression that splits CSV string into table

2010-09-10 Thread Nick
What would be the regexp_split_to_table pattern that splits a comma separated string into a table? Im having trouble when a string contains commas or there are commas at the beginning or end String ',one,two,''three,four'',five,six,' Should return ,one two three,four five six, -- Sent via pgsql

Re: [GENERAL] Regular expression that splits CSV string into table

2010-09-10 Thread Nick
Yes, that gets down to the root of my question... what is the expression that would properly split the values? -Nick On Sep 10, 4:43 pm, brick...@gmail.com (bricklen) wrote: > On Fri, Sep 10, 2010 at 3:43 PM, Nick wrote: > > What would be the regexp_split_to_table pattern that split

Re: [GENERAL] Regular expression that splits CSV string into table

2010-09-10 Thread Nick
I dont mind if the commas are at the beginning and end, im more concerned about "three,four" staying in one row because its surrounded by quotes. -Nick On Sep 10, 6:03 pm, alvhe...@commandprompt.com (Alvaro Herrera) wrote: > Excerpts from Nick's message of vie sep 10 2

Re: [GENERAL] Is there a bug in FOR i IN 1..10 LOOP (8.4.4)?

2010-09-11 Thread Nick
Woops, figured it out. Just needed to declare the num_var := ''; On Sep 11, 10:45 pm, Nick wrote: > CREATE FUNCTION test() RETURNS text >     LANGUAGE plpgsql >     AS $$DECLARE >   num_var TEXT; > BEGIN >   FOR i IN 1..10 LOOP >     num_var := num_var || &#x

[GENERAL] Is there a bug in FOR i IN 1..10 LOOP (8.4.4)?

2010-09-11 Thread Nick
CREATE FUNCTION test() RETURNS text LANGUAGE plpgsql AS $$DECLARE num_var TEXT; BEGIN FOR i IN 1..10 LOOP num_var := num_var || ',' || i; END LOOP; RETURN num_var; END;$$; SELECT test(); returns NULL -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To ma

[GENERAL] Incorrect results with NOT IN

2008-08-14 Thread Nick
I have a weird scenario on a table when I run this query... table1 has 1500 rows table2 has 1200 rows table2.id is a foreign key of table1.id SELECT COUNT(*) FROM table1 WHERE id NOT IN ( SELECT id FROM table2 ); however, using NOT EXISTS works SELECT COUNT(*) FROM table1 WHERE NOT EXISTS (

Re: [GENERAL] Incorrect results with NOT IN

2008-08-17 Thread Nick
Wow, very good to know. That was driving me crazy. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Can anyone help setting up pgbouncer?

2009-11-13 Thread Nick
Im trying to set up pgbouncer. Installation seemed to go well but when I try... $ pgbouncer -d pgbouncer.ini I get an error... 2009-11-13 02:02:35.170 7245 ERROR broken auth file 2009-11-13 02:02:35.170 7245 LOG File descriptor limit: 1024 (H:1024), max_client_conn: 100, max fds possible: 110 H

Re: [GENERAL] Can anyone help setting up pgbouncer?

2009-11-13 Thread Nick
_file = users.tx admin_users = nboutelier On Nov 13, 1:58 am, d...@archonet.com (Richard Huxton) wrote: > Nick wrote: > > Im trying to set up pgbouncer. Installation seemed to go well but when > > I try... > > > $ pgbouncer -d pgbouncer.ini > > > I get an error... &g

Re: [GENERAL] Can anyone help setting up pgbouncer?

2009-11-17 Thread Nick
listening on unix:/tmp/.s.PGSQL.6432 2009-11-17 03:10:29.193 24132 ERROR unconfigured_file: No such file or directory 2009-11-17 03:10:29.528 24132 ERROR unconfigured_file: No such file or directory 2009-11-17 03:10:29.863 24132 ERROR unconfigured_file: No such file or directory On Nov 14, 12:02 

Re: [GENERAL] Can anyone help setting up pgbouncer?

2009-11-17 Thread Nick
On Nov 17, 3:38 am, d...@archonet.com (Richard Huxton) wrote: > Nick wrote: > > Thanks Richard, I updated my users.txt file to include quotes (it > > didn't) which fixed the broken auth file error, but now im getting > > this... > > > 1518 ERROR unconfigu

Re: [GENERAL] Can anyone help setting up pgbouncer?

2009-11-17 Thread Nick
nnect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 6543 Thanks for you help and patience. -Nick On Nov 17, 3:38 am, d...@archonet.com (Richard Huxton) wrote: > Nick wrote: > > Thanks Richard, I updated my us

Re: [GENERAL] Can anyone help setting up pgbouncer?

2009-11-18 Thread Nick
On Nov 18, 12:43 pm, d...@archonet.com (Richard Huxton) wrote: > Nick wrote: > > So now the only step I have left is actually connecting. Im trying to > > connect a php script topgbouncerwith > > > $conn = pg_connect("host=127.0.0.1 dbname=bouncer1 port=6543 > >

Re: [GENERAL] Can anyone help setting up pgbouncer?

2009-11-18 Thread Nick
On Nov 18, 3:28 pm, d...@archonet.com (Richard Huxton) wrote: > Nick wrote: > > > lsof -i | greppgbouncer > > > results in no output. > > Then it's either not running or not listening on a port (you did run > that as root, didn't you?

[GENERAL] Installation of Postgis/postgresql

2009-12-28 Thread Nick
and we have a current version of the gcc compiler on the computer Thanks, Nick -- 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] Installation of Postgis/postgresql

2009-12-28 Thread Nick
On Dec 28, 7:20 pm, a...@squeakycode.net (Andy Colson) wrote: > On 12/28/2009 08:24 PM, Nick wrote: > > > > > Trying to install postgis on LINUX machine, need to find the geos- > > config file, as seems it is no where to be found after download of > > postgis in

Re: [GENERAL] Installation of Postgis/postgresql

2009-12-29 Thread Nick
find more info so we can move on from install stage. Any more ideas appreciated...Thanks, Nick -- 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] Installation of Postgis/postgresql

2009-12-29 Thread Nick
find more info so we can move on from install stage. Any more ideas appreciated...Thanks, Nick -- 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] Installation of Postgis/postgresql

2009-12-29 Thread Nick
find more info so we can move on from install stage. Any more ideas appreciated...Thanks, Nick -- 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] Installation of Postgis/postgresql

2009-12-29 Thread Nick
On Dec 28, 8:22 pm, pie...@hogranch.com (John R Pierce) wrote: > Nick wrote: > > 'g++' or g++ says -bash g++: command not found > > > distro is red hat > > Assuming thats RHEL5, > >     yum install gcc-c++ > > if its RHEL4 or earlier, use up2date i

Re: [GENERAL] Installation of Postgis/postgresql

2009-12-29 Thread Nick
On Dec 29, 1:21 pm, Nick wrote: > On Dec 28, 8:22 pm, pie...@hogranch.com (John R Pierce) wrote: > > > > > Nick wrote: > > > 'g++' or g++ says -bash g++: command not found > > > > distro is red hat > > > Assuming thats RHEL5, > &

Re: [GENERAL] Installation of Postgis/postgresql

2009-12-29 Thread Nick
On Dec 28, 8:22 pm, pie...@hogranch.com (John R Pierce) wrote: > Nick wrote: > > 'g++' or g++ says -bash g++: command not found > > > distro is red hat > > Assuming thats RHEL5, > >     yum install gcc-c++ > > if its RHEL4 or earlier, use up2date i

Re: [GENERAL] Installation of Postgis/postgresql

2009-12-29 Thread Nick
On Dec 29, 1:21 pm, Nick wrote: > On Dec 28, 8:22 pm, pie...@hogranch.com (John R Pierce) wrote: > > > > > Nick wrote: > > > 'g++' or g++ says -bash g++: command not found > > > > distro is red hat > > > Assuming thats RHEL5, > &

Re: [GENERAL] Installation of Postgis/postgresql

2009-12-29 Thread Nick
On Dec 29, 4:19 pm, j...@commandprompt.com ("Joshua D. Drake") wrote: > On Tue, 2009-12-29 at 13:21 -0800, Nick wrote: > > On Dec 28, 8:22 pm, pie...@hogranch.com (John R Pierce) wrote: > > > Nick wrote: > > > > 'g++' or g++ says -bash

Re: [GENERAL] Installation of Postgis/postgresql

2009-12-29 Thread Nick
On Dec 29, 4:19 pm, j...@commandprompt.com ("Joshua D. Drake") wrote: > On Tue, 2009-12-29 at 13:21 -0800, Nick wrote: > > On Dec 28, 8:22 pm, pie...@hogranch.com (John R Pierce) wrote: > > > Nick wrote: > > > > 'g++' or g++ says -bash

Re: [GENERAL] Installation of Postgis/postgresql

2009-12-29 Thread Nick
On Dec 29, 4:19 pm, j...@commandprompt.com ("Joshua D. Drake") wrote: > On Tue, 2009-12-29 at 13:21 -0800, Nick wrote: > > On Dec 28, 8:22 pm, pie...@hogranch.com (John R Pierce) wrote: > > > Nick wrote: > > > > 'g++' or g++ says -bash

[GENERAL] postgresql/postgis installation

2009-12-30 Thread Nick
Trying to install postgis on LINUX machine, need to find the geos- config file, as seems it is no where to be found after download of postgis in the ./configure step, is there anyone that can give me a clue on how to find this file? Ultimate goal is to get postgis working so we can use geom data ty

[GENERAL] Error during make when installing geos for postgis install...still trying

2009-12-31 Thread Nick
Still having problems installing the geos file when trying to install postgis...have a printout of errors we are still getting computer/compiler/postgis info rhel 5, gcc-4.1.2-46el14.4.1 postgis1.4.0 below is our process and the errors we are getting, can anyone tell us where the issue is? [r

[GENERAL] Index not used when using a function

2010-01-13 Thread Nick
SELECT * FROM locations WHERE id = 12345 LIMIT 1 uses the primary key (id) index, but... SELECT * FROM locations WHERE id = get_location_id_from_ip(641923892) LIMIT 1 does not and is verrry slow. Any ideas why? Whats weird is that it works (uses index) on a previous db, but when I copied everyth

Re: [GENERAL] Index not used when using a function

2010-01-13 Thread Nick
On Jan 13, 4:21 pm, t...@sss.pgh.pa.us (Tom Lane) wrote: > Nick writes: > > SELECT * FROM locations WHERE id = 12345 LIMIT 1 > > uses the primary key (id) index, but... > > SELECT * FROM locations WHERE id = get_location_id_from_ip(641923892) > > LIMIT 1 > > does

Re: [GENERAL] Problem with query using ST_Dwithin

2010-01-28 Thread Nick
On Jan 28, 4:32 pm, Nick wrote: > The following query's all work fine, > > select distinct zoa_metar_xml.stn_id, zoa_metar_xml.metar_txt, > zoa_metar_xml.time, zoa_metar_xml.flt_cat, zoa_metar_xml.cld_cvr, > zoa_metar_xml.cld_base, zoa_metar_xml.lonlat, zoa_metar_xml.geom

[GENERAL] Problem with query using ST_Dwithin

2010-01-28 Thread Nick
sectors_basetop.geom or artcc.the_geom, because the last working query also works when matching intersecting polygons with the zoa_sectors_basetop.geom. So looks like the problem may lie in the geometry in the table zoa_metar_xml. But can't figure why? Hope this is enough info, can anyone help

[GENERAL] Whats the most efficient query for this result?

2012-01-17 Thread Nick
I have three tables (users, books, pencils) and would like to get a list of all users with a count and total price of their books and pencils for 2012-01-01... So with this data... users (user_id) 1 2 3 books (user_id, price, created) 1 | $10 | 2012-01-01 1 | $10 | 2012-01-01 3 | $10 | 2012-01-0

Re: [GENERAL] Whats the most efficient query for this result?

2012-01-17 Thread Nick
On Jan 17, 3:33 am, t...@audioboundary.com (Tom Molesworth) wrote: > Hi Nick, > > On 17/01/12 00:18, Nick wrote: > > > > > > > > > > > I have three tables (users, books, pencils) and would like to get a > > list of all users with a count and total

Re: [GENERAL] Whats the most efficient query for this result?

2012-01-17 Thread Nick
On Jan 17, 3:33 am, t...@audioboundary.com (Tom Molesworth) wrote: > Hi Nick, > > On 17/01/12 00:18, Nick wrote: > > > > > > > > > > > I have three tables (users, books, pencils) and would like to get a > > list of all users with a count and total

Re: [GENERAL] Whats the most efficient query for this result?

2012-01-17 Thread Nick
On Jan 17, 3:33 am, t...@audioboundary.com (Tom Molesworth) wrote: > Hi Nick, > > On 17/01/12 00:18, Nick wrote: > > > > > > > > > > > I have three tables (users, books, pencils) and would like to get a > > list of all users with a count and total

[GENERAL] How to know if update is from a foreign key cascade in plperl?

2012-01-25 Thread Nick
Is it possible (in a plperl function) to know if an update is from a foreign key cascade, rather than just a user submitted update statement? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-genera

[GENERAL] Help speeding up a left join aggregate

2012-01-31 Thread Nick
I have a pretty well tuned setup, with appropriate indexes and 16GB of available RAM. Should this be taking this long? I forced it to not use a sequential scan and that only knocked a second off the plan. QUERY PLAN --

[GENERAL] Yearly date comparison?

2012-02-28 Thread Nick
What is the best way to find an event with a yearly occurrence? CREATE TABLE events ( start_date DATE, end_date DATE, recurring TEXT ); INSERT INTO events (start_date, end_date, recurring) VALUES ('2010-02-28','2010-03-01','yearly'); SELECT * FROM events WHERE (start_date+'2 YEARS'::I

[GENERAL] Error trying to set up streaming replication

2012-03-26 Thread Nick
I followed the instructions from http://packetcloud.net/2010/12/09/setting-up-streaming-replication-in-postgresql-9-0/ When I start the standby I get this... LOG: database system was shut down in recovery at 2012-03-26 17:36:32 PDT LOG: entering standby mode cp: cannot stat `/var/lib/postgresql

[GENERAL] How to avoid multiple table scan with "NOT IN"

2009-03-21 Thread Nick
Is there any way this query could be written that doesnt scan the subquery table twice? SELECT * FROM my_table WHERE (one,two) NOT IN (SELECT sub_one, sub_two FROM my_sub_table) AND (two,one) NOT IN (SELECT sub_one, sub_two FROM my_sub_table) -- Sent via pgsql-general mailing list (pgsql-general

[GENERAL] Regular expression and array

2009-05-26 Thread Nick
I wont go into details about why im using this field as an array but how would I select all the rows that have the first name 'Tom' out of the 'names' field? CREATE TABLE test ( id integer, names character varying[] ); INSERT INTO test VALUES (1, '{"''Josh Berkus''","''Peter Eisentraut''",

[GENERAL] What is the postgres version of mysql's "ON DUPLICATE KEY"

2004-09-10 Thread Nick
. Standard or not, it is very usefull. Is there a way to catch the insert error. For example... INSERT INTO related_products (product_id,related_product_id) VALUES (?,?); IF (???error: duplicate key???) THEN UPDATE related_products SET related_counter = related_counter + 1; END IF; -Nick

[GENERAL] Auto increment/sequence on multiple columns?

2004-09-10 Thread Nick
ty tedious. -Nick ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html

Re: [GENERAL] Slave claims requested WAL segment already removed - but it wasn't

2016-06-03 Thread Nick Cleaton
On 2 June 2016 at 02:43, Jeff Beck wrote: > Hi- > We have a master (pg 9.4.4 on Ubuntu 14.10) and a slave (pg 9.4.8 on > Centos 7). During a period of heavy use, the slave began complaining > that the “requested WAL segment xx has already been removed”. But > the WAL segment was still on the m

[GENERAL] Replication with non-read-only standby.

2016-06-30 Thread Nick Babadzhanian
ive solution to this? Regards, Nick. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] pglogical cascading replication (chaining replication)

2016-07-12 Thread Nick Babadzhanian
I apologize if this is wrong place to ask the question. A quote from pglogical FAQ: > Q. Does pglogical support cascaded replication? > Subscribers can be configured as publishers as well thus cascaded replication > can be achieved > by forwarding/chaining (again no failover though). The only m

Re: [GENERAL] Replication with non-read-only standby.

2016-07-12 Thread Nick Babadzhanian
Thanks. I ended up using pglogical, since I don't really need Bi-directional replication and docs for UDR suggest using pglogical instead. Although I ran into a problem there, but pglogical seems to be the answer. Regards, Nick. - Original Message - From: "Sylvain Marechal&q

Re: [GENERAL] pglogical cascading replication (chaining replication)

2016-07-13 Thread Nick Babadzhanian
G: worker process: pglogical apply 13294:1876007473 (PID 14180) exited with >exit code 1 >LOG: starting apply for subscription sub_p2_to_p3_insert_only >ERROR: cache lookup failed for replication origin >'pgl_test_node_p1_provider_sub_p1_t06410f8' >LOG: worke

Re: [GENERAL] pglogical cascading replication (chaining replication)

2016-07-14 Thread Nick Babadzhanian
I already tried to contact them, but no luck so far. Although it seems to me that the change-set is actually forwarded, its the decoding that is failing on the receiving host. Check the log output for p2 and p3 in my previous message. Regards, Nick. - Original Message - From: "J

Re: [GENERAL] Merging timeseries in postgres

2016-07-14 Thread Nick Babadzhanian
Whats exactly is wrong with the following query? select dx date, nx, nx1 from test t join test1 t1 on t.dx=t1.dx1 ; - Original Message - From: "Tim Smith" To: "pgsql-general" Sent: Thursday, July 14, 2016 2:56:19 PM Subject: [GENERAL] Me

Re: [GENERAL] Merging timeseries in postgres

2016-07-14 Thread Nick Babadzhanian
Nevermind, I misunderstood your question. The answer is an outer join and if you want the exact output you provided then you can use the following clause. coalesce(dx, dx1) as date Is there any reason why these are two different tables? I'd consider changing data structure. - Original Mes

Re: [GENERAL] pglogical cascading replication (chaining replication)

2016-07-19 Thread Nick Babadzhanian
The solution was found thanks to Petr Jelinek from 2ndQ. > Cascading wasn't much of a priority so far. > Currently you have to create the origin manually using > pg_replication_origin_create(). > I plan to make this work seamlessly in the future release. So whats needed to be done is: on p1:

Re: [GENERAL] pglogical cascading replication (chaining replication)

2016-07-19 Thread Nick Babadzhanian
e done is: on p2: select * from pg_replication_origin; will show all origins on p2, find the origin for p1; on p3: select pg_replication_origin_create('[origin name]'); Discussed here: https://github.com/2ndQuadrant/pglogical/issues/23 Please ignore previous message; Regards,

[GENERAL] Build in function to verify email addresses

2017-11-15 Thread Nick Dro
I beleieve that every information system has the needs to send emails. Currently PostgreSQL doesn't have a function which gets TEXT and return true if it's valid email address (x...@yyy.com / .co.ZZ) Do you believe such function should exist in PostgreSQL or it's best to let every user to implement

[GENERAL] 'Session local' variables

2007-07-01 Thread Nick Johnson
s and functions will be executed in the postgres process assigned to the connection that invokes them, and therefore each will have its own copy of the global variable? - How can I get a session-scoped MemoryContext to allocate nodes out of? Thanks, Nick Johnson ---(end of broa

Re: [GENERAL] 'Session local' variables

2007-07-01 Thread Nick Johnson
On 7/2/07, Tom Lane <[EMAIL PROTECTED]> wrote: "Nick Johnson" <[EMAIL PROTECTED]> writes: > I want to write a contrib module that exports a couple of functions > that PLs (that don't natively support this) can use to set/get > session-local variables. Um, wh

Re: [GENERAL] Date for a week day of a month

2007-07-03 Thread Nick Barr
7;::interval * last_dow); END; ' LANGUAGE plpgsql; =# select lastday('2007-04-01', 5); lastday 2007-04-26 (1 row) The second parameter is the day of the week that you want, which has the same spec as EXTRACT(dow FROM...). Values are from 0-6 where 0 is Sunday. E

Re: [GENERAL] Date for a week day of a month

2007-07-03 Thread Nick Barr
y + 2007-04-01 | 2007-04-26 jnb198_chuckie=# select '2007-04-10', lastday('2007-04-10', 4); ?column? | lastday + 2007-04-10 | 2007-04-26 Nick ---(end of broadcast)--- TIP 6: explain analyze is your friend

[GENERAL] strange timezone problem

2007-11-07 Thread Nick Johnson
Angeles'; select create_date from article_lead; create_date --- 2007-11-04 08:35:33.17-08 2007-11-03 21:35:36.09-07 <-- why 07? 2007-11-04 20:35:36.38-08 2007-11-05 08:35:36.67-08 Nick ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [GENERAL] strange timezone problem

2007-11-07 Thread Nick Johnson
On Wed, 7 Nov 2007, Tom Lane wrote: > Nick Johnson <[EMAIL PROTECTED]> writes: > > I'm using PostgreSQL 8.2.3 and seeing this behaviour with timezones: [snip] > > Shouldn't that second row have been in the results of the second query? > > Huh? Those r

[GENERAL] Are there any projects interested in object functionality? (+ rule bases)

2011-01-21 Thread Nick Rudnick
ckend constrain this in regard of performance? Thanks a lot in advance, Nick

Re: [GENERAL] Are there any projects interested in object functionality? (+ rule bases)

2011-01-21 Thread Nick Rudnick
allow them to use PostgreSQL for that sake. So I am meaning OO in a very broad sense. All the best, Nick On 01/21/2011 04:10 PM, Andy Colson wrote: Short answer: no. Here are some counter questions for you: Have you ever seen any actual real world usage of OORDBMS? Are there any products

Re: [GENERAL] Are there any projects interested in object functionality? (+ rule bases)

2011-01-21 Thread Nick Rudnick
architecture will do really significantly slower than OODBMS/ORDBMS more specialized for that sake (the same with rules...)?? Or is it worth to give it a try? This would be my last resort, Nick Although postgres at one time had "ORDBMS" as a goal, I haven't seen any real inte

[GENERAL] data type

2011-03-02 Thread Nick Raj
Hi, I am writing some function in postgres pl/sql. My function is of type St_ABC((select obj_geom from XYZ),(select boundary_geom from boundary)) I have table XYZ with 20,000 tuples and in boundary, i have only one geometry. In postgres, ST_intersects(obj_geom, boundary_geom) checks each obj_geom

[GENERAL] Composite index structure

2011-03-06 Thread Nick Raj
Hi all, I want to construct an "Composite Index Structure" i.e. a combination of gist and btree. What i am thinking is that first creating a Rtree structure that is pointing to another Btree structure. For example, Suppose i want to find vehicles between 2 to 4 pm on 14/2/2011 on X road. I am thi

[GENERAL] OT: Oleg Bartunov in Himalaya...

2011-03-16 Thread Nick Rudnick
x27;t reject the reflex to post this here, wow... Please excuse & all the best, Nick -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Understanding Datum

2011-03-23 Thread Nick Raj
Hi, I am understanding the postgres code. In code, i just want to see what are values that are passing through the variables? Can you please tell me if the variable is of type Datum, then how to print its value? Because i dont the variable v type. And also what the structure of Datum? Thanks, Raj

Re: [GENERAL] Understanding Datum

2011-03-23 Thread Nick Raj
?? How to find out what type of pointer argument is PG_GETARG_POINTER(1)?? Thanks, Nirmesh On Wed, Mar 23, 2011 at 11:40 PM, Radosław Smogura wrote: > Nick Raj Wednesday 23 March 2011 18:45:41 > > Hi, > > I am understanding the postgres code. In code, i just want to see what > a

Re: [GENERAL] Understanding Datum

2011-03-23 Thread Nick Raj
lue of Datum in postgres? On Thu, Mar 24, 2011 at 2:35 AM, Tom Lane wrote: > Nick Raj writes: > > In postgres, typedef uintptr_t Datum > > Datum is getting value from PG_GETARG_POINTER(1); > > But, now problem is how would i know the type of PG_GETARG_POINTER(1) > > (

[GENERAL] Integrating New Data Type

2011-04-05 Thread Nick Raj
Hi all, I have defined a new data type. I have defined in and out function for that data type. But i want to know how to integrate this data type with postgres (how postgres compile my code or know my datatype) ? Thanks, Nirmesh

[GENERAL] Global Variables in plpgsql

2011-04-11 Thread Nick Raj
Hi, Can anyone know how to define global variable in plpgsql? Thanks Regards, Raj

[GENERAL] Why does autovacuum clean fewer rows than I expect?

2014-07-03 Thread Nick Cabatoff
Hi, I'm having trouble making sense of the these two autovacuum log entries. I'm running PostgreSQL 8.4. [2014-05-22 04:56:43.486 EST] {537cf2c6.30f9} LOG: automatic vacuum of table "postgres.globaldicom.requests": index scans: 1 pages: 0 removed, 163600 remain tuples: 5916 rem

  1   2   >