Re: [GENERAL] unique across two tables

2011-06-22 Thread Misa Simic
Hi Tarlika, I think easy solution could be: create baseTable with just one column as PK TableA inhertis baseTable, it will have inherited Column + additianl tables for TableA TableB inherits baseTable, it will aslo have inherited Column + additianl tables for TableB Insert in any table TableA

Re: [GENERAL] unique across two tables

2011-06-22 Thread Misa Simic
implementation can be found in section 5.8 (Inheritance) of the documentation. It is in the “Data Definition” chapter. ** ** David J. ** ** ** ** *From:* pgsql-general-ow...@postgresql.org [mailto: pgsql-general-ow...@postgresql.org] *On Behalf Of *Misa Simic *Sent:* Wednesday

Re: [GENERAL] Select count with offset returns nothing.

2011-08-05 Thread Misa Simic
Hi, I think problem is in OFFSET 15 It means return rows after row 15... because of SELECT COUNT(*) FROM batches LIMIT 15 returns 1 row when you add OFFSET 15 - it returns nothing... because of there is no more than 15 rows... I am not sure u can do something else then to change library to

[GENERAL] UUID datatype and GIST index support

2011-08-19 Thread Misa Simic
Hi, Is there maybe GIST support patch for UUID datatype? I do not it it concretly just for UUID column... it is more because of I need it in EXCLUDE constraint... CREATE TABLE test_exclude { id serial NOT NULL, guid uuid NOT NULL, valid_period period NOT NULL, CONSTRAINT test_excludepk PRIMARY

Re: [GENERAL] indexes and tables

2011-12-19 Thread Misa Simic
Hi Amit, Have you maybe tested what David J has suggested? In other words it is: • Create 10 tables with their columns and indexes on each t1(a1,a2,a3) t2(b1,b2,b3) . . . t10(n1,n2,n3) •Create VIEW with union all 10 tables SELECT a1 AS f1, a2 as f2, a3 as f3 from t1 Union SELECT b1 as f1, b2 as

Re: [GENERAL] design help for performance

2011-12-20 Thread Misa Simic
Hi Culley, Have you tried to create fk together with index on fk column on table B? What are results? Would be good if you could send the query and explain analyze... Sent from my Windows Phone -- From: Culley Harrelson Sent: 21 December 2011 00:57 To:

Re: [GENERAL] [partition table] python fetchall or fetchone function can not get the returning rows

2011-12-21 Thread Misa Simic
Hi Xiaoning, I need to say i don't have experience with RETURNING... So don't know what could be wrong... But the way how we usually deal with same issue is: Serial column has sequence next value as default value... So usually we first take next seq value and in insert we include pk column with

Re: [GENERAL] design help for performance

2011-12-21 Thread Misa Simic
Hm... I think result on the end will be the same... I am not sure realation produce any locks on parent table... What produces locks is UPDATE, so is it on table A or C should make no difference... If simple join and count fk is so slow - other option would be materialized view... So it would

Re: [GENERAL] function return update count

2012-01-05 Thread Misa Simic
You could try: 1) return UPDATE table OR 2) use plpsql function instead of SQL UPDATE table GET DIAGNOSTICS variable = ROW_COUNT RETURN variable Kind regards, Misa Sent from my Windows Phone -- From: Kevin Duffy Sent: 06/01/2012 06:21 To:

Re: [GENERAL] function return update count

2012-01-05 Thread Misa Simic
Sorry, Option 1) is wrong answer... :) Option 2 should work Sent from my Windows Phone -- From: Misa Simic Sent: 06/01/2012 08:34 To: Kevin Duffy; pgsql-general@postgresql.org Subject: RE: [GENERAL] function return update count You could try: 1) return UPDATE

Re: [GENERAL] how to make select for multiunit

2012-01-15 Thread Misa Simic
Hi, I have understood he does not want to round... I would make custom type myUofM KRT int, PAK int, PCS int Then function to_myUofM which has 1 input parametar as int, and returns myUofM, (imutable func) so SELECT to_myUofM(25) returns 0,2,5 25 PCS is 0 KRT, 2 PAK and 5 PCS Then query:

Re: [GENERAL] Immutable function with bind value

2012-01-20 Thread Misa Simic
Hi Brice, I think You are right, problem is just in php prepare/bindvalue So it should be avoided... I guess the reason you like to use bindvalue is safety in SQL injection problem... what should be handled on some way what depends on concrete case... But far as I am aware string as input

Re: [GENERAL] Logging access to data in database table

2012-01-25 Thread Misa Simic
Well, You could use dblink in your access_function() to log it... But maybe it would be better to reorganise security on the way that users who do not need to have access to some data - simply do not have it (instead of to give them data and latter check log to confirm they have taken it...)

Re: [GENERAL] Logging access to data in database table

2012-01-25 Thread Misa Simic
... (concretly in our case - Users do not have access to DB at all... everything is through Web App, actually DB - Web Service - User Apps (Web, Windows, Mobile etc...)) Thanks, Misa 2012/1/25 Bill Moran wmo...@potentialtech.com In response to Misa Simic misa.si...@gmail.com: But maybe it would

Re: [GENERAL] Triggering a function on table overwrite

2012-02-06 Thread Misa Simic
Hi Bob, I guess with overwrite the table you mean to fill some columns with your values in trigger... If that is the case, in docs is example: http://www.postgresql.org/docs/8.1/static/plpgsql-trigger.html Kind Regards, Misa Sent from my Windows Phone -- From: Bob

Re: [GENERAL] Triggering a function on table overwrite

2012-02-06 Thread Misa Simic
is it for current version (Though I have no idea which version user is on)... I would probably no answer at all... too much effort for simple help... 2012/2/6 Chris Angelico ros...@gmail.com On Mon, Feb 6, 2012 at 8:42 PM, Thomas Kellerer spam_ea...@gmx.net wrote: Misa Simic, 06.02.2012 10:35: Hi

Re: [GENERAL] How to create crosstab with 3 values in every crosstab column

2012-02-06 Thread Misa Simic
Hm... I am not sure it is possible at all and with just 1 column for crosstab (instead of 3) to return table with undefined No of columns (to number of stores do not be hardcoded)... At least you must define your return type... Problem is known to me, and we have solved it on some way... which

Re: [GENERAL] How to create crosstab with 3 values in every crosstab column

2012-02-06 Thread Misa Simic
Hi, I think you dont understand me (or I do not understand you :) ) the point is - it is not possible to get unknown no of columns in 1 SQL query... i.e. Account, Store, Amount 100, St1, 1000.00 100, St2, 2000.00 to get: Acount,St1 , St2 100, 1000.00 2000.00 to get

Re: [GENERAL] How to create crosstab with 3 values in every crosstab column

2012-02-06 Thread Misa Simic
Hi, Well, I think you will need to write your own function(s) which will solve your particular case... There are two ways explaind in last mails... Dynamic SQL or direct export to file... Kind Regards, Misa 2012/2/6 Andrus kobrule...@hot.ee Thank you. the point is - it is not possible

Re: [GENERAL] How do I setup this Exclusion Constraint?

2012-05-01 Thread Misa Simic
Hi I think for overlaping exclusion constraint you need period extension or range datatype in 9.2 Kind Regards, Misa Sent from my Windows Phone From: bradford Sent: 01/05/2012 19:16 To: pgsql-general@postgresql.org Subject: [GENERAL] How do I setup this Exclusion Constraint? I would like to

Re: [GENERAL] How do I setup this Exclusion Constraint?

2012-05-02 Thread Misa Simic
Hi, I think yes... Just should add WHERE on the end of EXCLUDE... Sent from my Windows Phone From: bradford Sent: 02/05/2012 16:02 To: Misa Simic Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] How do I setup this Exclusion Constraint? It works w/o that range datatype, which I had

Re: [GENERAL] SELECT issue with references to different tables

2012-06-03 Thread Misa Simic
Hi Alex, I think would be better to reorganise model to awoid NULLs i.e. to includ new table: owners -owner_id -owner_name -ownertype (person/comapny) and have yours person_details table... and comapny_details_table... related 1:1 to owner_id However, solution for your way I think would

Re: [GENERAL] Trying to execute several queries involving temp tables in a PHP script

2012-06-13 Thread Misa Simic
Hi Alexander, I think you can have all in one query, without temp tables: SELECT r.rid, r.cards, to_char(r.stamp, 'DD.MM. HH24:MI') as day, c.bid, c.trix, c.pos, c.money, c.last_ip, c.quit, u.id, u.first_name, u.avatar, u.female, u.city, u.vip

Re: [GENERAL] Trying to execute several queries involving temp tables in a PHP script

2012-06-13 Thread Misa Simic
I agree with approach to have all in functions... In that case there would not be a problem with temp tables because of inside 1 transaction they would work... suggestion was just to solve problem from php... what would be achiavable just trough 1 query, or to use PDO and then:

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Misa Simic
I think temp table, would be better option if you must decide from some reason... However, why would you use View or temp table in that scenario? I mean what would be wrong with: CREATE OR REPLACE FUNCTION MyFun(INTEGER) RETURNS SETOF B AS $BODY$ SELECT * FROM B;

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Misa Simic
Woops, I thought: CREATE OR REPLACE FUNCTION MyFun(IdArgs INTEGER) RETURNS SETOF B AS $BODY$ SELECT * FROM B WHERE Id = $1; $BODY$ LANGUAGE 'sql' STABLE COST 100; 2012/6/13 Misa Simic misa.si...@gmail.com I think temp table, would be better option if you

[GENERAL] LEFT and RIGHT JOIN

2012-06-29 Thread Misa Simic
Hi, I have met some strange situation... Could someone explain difference between LEFT and RIGHT JOIN? I thought it is just from whitch side we are looking in JOIN columns part... but it seems that is not the case I have three Tables with the same structure... CREATE TABLE t1 ( id integer

Re: [GENERAL] LEFT and RIGHT JOIN

2012-06-29 Thread Misa Simic
Thanks Tom, Yes you are right... I wanted: t1 left join (t2 inner join t3) Is there a way to say that? I mean to me, it is logical and without brackets... i.e. t1 left join t2 inner join t3 left join t4, I would read as: t1 left join (t2 inner join t3) left join t4 (Like INNER has advantage

Re: [GENERAL] LEFT and RIGHT JOIN

2012-06-29 Thread Misa Simic
inner joint t3... to me was the same as t2 inner join t3 right join t1 what obviusly is not the case :) Many thanks, Misa 2012/6/30 David Johnston pol...@yahoo.com From: pgsql-general-ow...@postgresql.org [mailto: pgsql-general-ow...@postgresql.org] On Behalf Of Misa Simic Sent: Friday

Re: [GENERAL] how to return results from code block

2012-06-30 Thread Misa Simic
Hi Andrus, What is the main goal? Actually what is the reason that you need to execute, and get result in ADO.NET from code block? How I see code block feature, it is more to make easier dev test of an procedural language function inside code block... Then when we are happy with result, actually

Re: [GENERAL] Complex database infrastructure - how to?

2012-06-30 Thread Misa Simic
Hi Edson, Maybe the best option is what Jack has already suggested, to have all in 1 DB in separate schemas (if tables are not already organised in separated schemas...)... But I am not sure I understand well problems: 2012/6/30 Edson Richter edsonrich...@hotmail.com 1) Copy tables from

Re: [GENERAL] Range-Types in 9.2

2012-08-06 Thread Misa Simic
Hi, I just wonder about scenario in which time range would be usefull? (I mean, just time - not timestamp...) We have some scenario where we use time range as settings... Concrete case is: for each hour employee worked between 20:00 and 08:00 should be paid x, between 08:00 - 20:00 y... ( stored

Re: [GENERAL] crosstab

2012-09-04 Thread Misa Simic
No, you must use AS (..) in crosstab query... To actually, be able to create AS on unkown data in design time, what should produce an unknown result and unknown number of columns we are using Dynamic SQL to build AS part... (but of course function can't return result - just for export to csv

Re: [GENERAL] crosstab

2012-09-04 Thread Misa Simic
, Misa 2012/9/4 Aram Fingal fin...@multifactorial.com On Sep 4, 2012, at 4:18 PM, Misa Simic wrote: Inside PL/R you can take the same table as it is (unpivoted) as your data.frame and then pivot it inside R using reshape package,,, And then inside PL/R function do whatever you would like to do

Re: [GENERAL] crosstab

2012-09-04 Thread Misa Simic
Hi Joe, Do you maybe know, is it possible inside PL/R to call another PL/R function - but take result as R object (whatever R function returns)? If we take this scenario for example (Take some data from DB, pivot them, and save it as CSV)... pseudo code would be: -Execute SQL query -pivot

Re: [GENERAL] crosstab

2012-09-04 Thread Misa Simic
object, and methods of that object can be called :) Sorry, Misa 2012/9/5 Misa Simic misa.si...@gmail.com Hi Joe, Do you maybe know, is it possible inside PL/R to call another PL/R function - but take result as R object (whatever R function returns)? If we take this scenario for example (Take

Re: [GENERAL] crosstab

2012-09-04 Thread Misa Simic
Excellent :) Thanks - looks as acceptable workaround... Many thanks, Misa 2012/9/5 Joe Conway m...@joeconway.com On 09/04/2012 04:45 PM, Misa Simic wrote: Hi Joe, Do you maybe know, is it possible inside PL/R to call another PL/R function - but take result as R object (whatever R

Re: [GENERAL] Storing small image files

2013-05-09 Thread Misa Simic
2013/5/9 Nelson Green nelsongree...@gmail.com Thanks Karl, but I'm trying to do this from a psql shell. I can't use the C functions there, can I? On Thu, May 9, 2013 at 11:21 AM, Karl Denninger k...@denninger.netwrote: On 5/9/2013 11:12 AM, Karl Denninger wrote: On 5/9/2013 10:51 AM,

Re: [GENERAL] Storing small image files

2013-05-09 Thread Misa Simic
that meets my immediate need. Thanks! On Thu, May 9, 2013 at 12:31 PM, Misa Simic misa.si...@gmail.com wrote: 2013/5/9 Nelson Green nelsongree...@gmail.com Thanks Karl, but I'm trying to do this from a psql shell. I can't use the C functions there, can I? On Thu, May 9, 2013 at 11

Re: [GENERAL] Storing small image files

2013-05-10 Thread Misa Simic
2013/5/10 Eduardo Morras emorr...@yahoo.es Hi Nelson. I worked with images and Postgresql, and want to add some comments: On Thu, 9 May 2013 13:40:15 -0500 Nelson Green nelsongree...@gmail.com wrote: OK, this is kind of convoluted, but I got a couple of test cases that work for me. The

Re: [GENERAL] Longest Common Subsequence in Postgres - Algorithm Challenge

2013-07-09 Thread Misa Simic
On Monday, July 8, 2013, Robert James wrote: On 7/8/13, hubert depesz lubaczewski dep...@depesz.com javascript:; wrote: On Mon, Jul 08, 2013 at 09:09:26AM -0400, Robert James wrote: I have two relations, where each relation has two fields, one indicating a name and one indicating a

[GENERAL] Grouping, Aggregate, Min, Max

2013-12-13 Thread Misa Simic
Hi All, I am not sure how to define with words what I want to accomplish (so can't ask google the right question :) ) So will try to explain with sample data and expected result: Scenario 1) id thing_id category period_id 1 1 A 1 2 1 A 2 3 1 A 3 4 1 A 4 5 1 A 5 6 1 A 6 7 1 A 7 8 1 A

Re: [GENERAL] Grouping, Aggregate, Min, Max

2013-12-13 Thread Misa Simic
aggregates : I think it will give you your answer. http://postgresql.1045698.n5.nabble.com/Count-of-records-in-a-row-td5775363i20.html Cheers, Rémi-C 2013/12/13 Misa Simic misa.si...@gmail.com Hi All, I am not sure how to define with words what I want to accomplish (so can't ask google

Re: [GENERAL] Grouping, Aggregate, Min, Max

2013-12-16 Thread Misa Simic
2013/12/13 Kevin Grittner kgri...@ymail.com Misa Simic misa.si...@gmail.com wrote: So I wonder - is there some kind of aggregate window function what does desired results? Not built in, but PostgreSQL makes it pretty easy to do so. With a little effort to define your own aggregate

Re: [GENERAL] pervasiveness of surrogate (also called synthetic) keys

2011-05-04 Thread Misa Simic
2011/4/28 Merlin Moncure mmonc...@gmail.com On Thu, Apr 28, 2011 at 12:29 PM, Jim Irrer ir...@umich.edu wrote: *) most tables don't have unique natural keys (let's see em) etc i.e for an Invoice, we have at least 2 tables (more in practice...): Invoice Header -Invoice Number -Date

Re: [GENERAL] pervasiveness of surrogate (also called synthetic) keys

2011-05-04 Thread Misa Simic
2011/5/4 Merlin Moncure mmonc...@gmail.com Most of the old school accounting systems maintained an invoice line number. Invoice Line -Invoice Number -LineNo -ItemID -qty -Price The line number started from 1 (the first line on the invoice) on every unique

Re: [GENERAL] pervasiveness of surrogate (also called synthetic) keys

2011-05-04 Thread Misa Simic
Being the “first line” or the “second line” of a physical invoice is a property for that line. Identifying its position on the invoice is only natural. Specifically, the position of the line on the invoice; you can't have to invoice lines at the second line of aninvoice for example.

Re: [GENERAL] Multiple table relationship constraints

2011-05-06 Thread Misa Simic
I think the best way is what David has suggested... But if it is already live, and there is no way to handle clients app to work with functions (instead of Direct SQL statements) then I think trigger function would help... (not sure how it could be error prone..) So basically if function is

Re: [GENERAL] simple update query too long

2011-05-13 Thread Misa Simic
Hi, Would it be faster if you create Partial Index on inter field (btree) where inter 0 and then UPDATE grille SET inter = 0 WHERE inter 0 Kind Regards, Misa 2011/5/9 F T ouk...@gmail.com Hi list I use PostgreSQL 8.4.4. (with Postgis 1.4) I have a simple update query that takes hours

Re: [GENERAL] pivot functions with variable number of columns

2012-09-06 Thread Misa Simic
That is one of most wanted features of PostgreSQL, what is not solved yet,,, But it seems will be soon with introductions of Stored Procedures... For now, you must know what result (columns) you expects... So the only one option for now is to use Dynamic SQL - to build your query dynamically

Re: [GENERAL] pivot functions with variable number of columns

2012-09-06 Thread Misa Simic
:) I have made conlusion you are working on Stored Procedures things? I have a few questions about that... But will send another mail to dont mix subjects... Cheers, Misa On Thursday, September 6, 2012, Pavel Stehule wrote: Hello 2012/9/6 Misa Simic misa.si...@gmail.com javascript

[GENERAL] Re: [GENERAL] INSERT… RETURNING for copying records

2012-09-08 Thread Misa Simic
You can make function what returns integer and has input parametars as other columns of the table: INSERT INTO testing (category, name, fk_parent) (input parameters) returning rid Then SELECT rid as OriginalId, make_copy(other columns) as new_rid From testing Kind Regards, Misa On Friday,

[GENERAL] pljava and Postgres 9.2.1

2012-09-25 Thread Misa Simic
Hi, We have a bit strange error with pljava deploy and postgresql 9.2.1... We are not sure is it related to pljava itself, because of when we add to postgresql.conf: custom_variable_classes = 'pljava' we cant start Postgres any more... server log says; LOG: unrecognized configuration

Re: [GENERAL] pljava and Postgres 9.2.1

2012-09-25 Thread Misa Simic
Thanks Tom, without custom_variable_classes = 'pljava' but with pljava.classpath = pathTopljava.jar everything works fine.. Many thanks, Misa 2012/9/25 Tom Lane t...@sss.pgh.pa.us Misa Simic misa.si...@gmail.com writes: We have a bit strange error with pljava deploy and postgresql 9.2.1

[GENERAL] Postgresql PL parallel processing inside Postgresql function....

2012-12-11 Thread Misa Simic
Hi, I have a table of bunch of records: MainTable: -MainID -Other attributes Several Tables what Track Activities about MainIDs... And one routine written as plpgsql function what Loops trough MainTable and for each record, calls ProccessTheThing(MainID), What again sequentially calls,

Re: [GENERAL] partial time stamp query

2013-02-04 Thread Misa Simic
WHERE derived_tsoil_fifteen_min_stacked.time2::date = '2010-07-07'::date On Monday, February 4, 2013, Kirk Wythers wrote: I am trying to write a query that grabs one particular day from a timestamp column. The data are ordered in 15 minute chunks like this: 2010-07-07 12:45:00 2010-07-07

Re: [GENERAL] partial time stamp query

2013-02-04 Thread Misa Simic
works for the timestamp? On Feb 4, 2013, at 8:50 AM, Misa Simic misa.si...@gmail.commailto: misa.si...@gmail.com wrote: WHERE derived_tsoil_fifteen_min_stacked.time2::date = '2010-07-07'::date On Monday, February 4, 2013, Kirk Wythers wrote: I am trying to write a query that grabs

Re: [GENERAL] partial time stamp query

2013-02-05 Thread Misa Simic
BY derived_tsoil_fifteen_min_stacked.time2::date, extract('hour' FROM derived_tsoil_fifteen_min_stacked.time2), data_key.variable_name, data_key.plot ORDER BY 1 Sent from my Windows Phone -- From: Kirk Wythers Sent: 05/02/2013 04:40 To: Misa Simic Cc: Kirk Wythers; pgsql-general@postgresql.org Subject

Re: [GENERAL] Poor performance when using a window function in a view

2013-03-01 Thread Misa Simic
Hi Chris, You don't need to make a a full view - to join it later to less rows number table) If you have, function what takes fkey1 as input parameter and returns SET OF (type of your values_view) i.e. CREATE OR REPLACE FUNCTION get_filtered_values_view(in_fkey1 integer) RETURNS SETOF

Re: [GENERAL] Finding matching words in a word game

2013-03-06 Thread Misa Simic
Hi, I think you can make another table: Word, letter, count (word, letter - pk) In good_words add column sorted_letters. Now we can make a view based on that two tables: Word, letter, count, sorted_letters Now we need two immutable functions: 1. For given word returns sorted_letters word

Re: [GENERAL] How to join table to itself N times?

2013-03-22 Thread Misa Simic
Hi, Not clear what is expected result - if you add new dimension... a) three columns? - well not possible to write SQL query which returns undefined number of columns... unfortunatelly - though I am not clear why :) b) But you can get the similar result as from python... my guess is you expect:

Re: [GENERAL] How to join table to itself N times?

2013-03-22 Thread Misa Simic
correction: 2013/3/22 Misa Simic misa.si...@gmail.com Hi, Not clear what is expected result - if you add new dimension... a) three columns? - well not possible to write SQL query which returns undefined number of columns... unfortunatelly - though I am not clear why :) b) But you can

Re: [GENERAL] How to join table to itself N times?

2013-03-22 Thread Misa Simic
Simic misa.si...@gmail.com correction: 2013/3/22 Misa Simic misa.si...@gmail.com Hi, Not clear what is expected result - if you add new dimension... a) three columns? - well not possible to write SQL query which returns undefined number of columns... unfortunatelly - though I am

[GENERAL] PostgreSQL and VIEWS

2013-03-23 Thread Misa Simic
HI, When I have met PostgreSQL for a first time - I have been really amazed - with many things... But how we started to use it - and data jumps in - we meet performance problems... Now, it is a bit tricky... any concrete performance problem - can be solved on some way... However, I am more

Re: [GENERAL] PostgreSQL and VIEWS

2013-03-24 Thread Misa Simic
://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table 2013/3/24 Misa Simic misa.si...@gmail.com HI, When I have met PostgreSQL for a first time - I have been really amazed - with many things... But how we started to use it - and data jumps in - we meet performance

Re: [GENERAL] is there a way to deliver an array over column from a query window?

2013-03-24 Thread Misa Simic
maybe, SELECT DISTINCT issuer,amount, array_agg(REFERENCE) over (partition by invoice_nr) from invoices; 2013/3/24 Rafał Pietrak ra...@zorro.isa-geek.com Hi, I really don't know how to ask for what I'm looking for; but I think, may be, calling it an ARRAY yielding aggregate function for

Re: [GENERAL] PostgreSQL and VIEWS

2013-03-25 Thread Misa Simic
customers_view c INNER JOIN invoices USING (customer_id) WHERE invoice_id = 156 And solution to our problem is: rephrase the question :) Kind Regards, Misa 2013/3/25 Merlin Moncure mmonc...@gmail.com On Sat, Mar 23, 2013 at 9:25 PM, Misa Simic misa.si...@gmail.com wrote: HI, When I

Re: [GENERAL] PostgreSQL and VIEWS

2013-03-25 Thread Misa Simic
) - does not! Logically - that are the same queries... Thanks, Misa 2013/3/26 Merlin Moncure mmonc...@gmail.com On Mon, Mar 25, 2013 at 4:32 PM, Misa Simic misa.si...@gmail.com wrote: Thanks Merlin, Well... sorry, It could be and my bad english... but let me explain chronologicaly

Re: [GENERAL] Understanding behavior of SELECT with multiple unnested columns

2013-03-27 Thread Misa Simic
Hi, You can try: SELECT c1, c2 FROM ( WITH a AS ( SELECT row_number() OVER(),* FROM unnest(array['a','b', 'c', 'd']) c1 ), b AS ( SELECT row_number() OVER(),* FROM unnest(array['1','2', '3']) c2 ) SELECT * FROM a LEFT JOIN b USING (row_number) UNION SELECT * FROM a RIGHT JOIN b USING

Re: [GENERAL] Is there any way to listen to NOTIFY in php without polling?

2013-03-27 Thread Misa Simic
Hi, What is the main goal? even using libpg - you need to call pg notify... Doc says, just using libpgtcl would be possible to get Notify event - without checking from time to time... Kind Regards, Misa 2013/3/27 Clemens Eisserer linuxhi...@gmail.com Hi Bill, Is there any way to listen

Re: [GENERAL] Is there any way to listen to NOTIFY in php without polling?

2013-03-27 Thread Misa Simic
Hi Clemens, Well, I am not sure what you mean by polling... But Example shows - that C app - actually asks all the time to get notify... when gets something more then 4 times - exit... until 4 times loops... The same you can achieve with PHP... But I am not sure that is the main goal... My

Re: [GENERAL] Is there any way to listen to NOTIFY in php without polling?

2013-03-29 Thread Misa Simic
, March 28, 2013, Jasen Betts wrote: On 2013-03-27, Misa Simic misa.si...@gmail.com javascript:; wrote: --20cf3074d6a0c370ce04d8ef50c1 Content-Type: text/plain; charset=UTF-8 Hi Clemens, Well, I am not sure what you mean by polling... But Example shows - that C app - actually asks all

Re: [GENERAL] data modeling genes and alleles... help!

2013-03-30 Thread Misa Simic
Hi, If I have understood well You have two options: 1. Person_gene (person_id pk, gene_id int) Genes (gene_id serial pk, gene_type int) Then for each gene_type separate table with gene_id int what is pk and relates to genes... And other columns what describe that type...

Re: [GENERAL] Money casting too liberal?

2013-03-30 Thread Misa Simic
Interesting discussion. The comparisons with timezones ends when it comes to exchange rates. The rate at the time of transaction has to the stored (somewhere) associated with the base value. Timezones are rather fixed. +1 No way can be solved just by type On Saturday, March 30, 2013,

Re: [GENERAL] Money casting too liberal?

2013-03-31 Thread Misa Simic
Hi Gavan, It is more about are problems described can be solved just by datatype at all... Just SUM values in GL transactions table would not make sense in any case to accountants - regardless will result be big number or 0 (what always will/should be in normal situations)... Maybe better would

Re: [GENERAL] Using varchar primary keys.

2013-03-31 Thread Misa Simic
Hi Tim, Debate natural vs surrogate key last for a too long time - with no official winner... I think it is more religional then real issue... Advice will be simple: pick approach what best fit your needs, taking into account now and tomorrow (probability of change)... SQL standard and normal

Re: [GENERAL] Dynamic/polymorphic record/composite return types for C user-defined-functions

2013-04-02 Thread Misa Simic
Hi, We have solved that problem on the way to function always returns text, but text was actually formated json... We have used plv8 before 9.2 to actually execute dynamic SQL and return result... However, I think some kind of dynamic record type would be very usefull... (Maybe just record but

Re: [GENERAL] is there a way to deliver an array over column from a query window?

2013-04-25 Thread Misa Simic
a, b, c, d FROM testy where e 'email' and c='1035049' ORDER BY a, b, c, e ) Kind Regards, Misa 2013/4/24 Rafał Pietrak ra...@zorro.isa-geek.com W dniu 03/24/2013 12:11 PM, Rafał Pietrak pisze: W dniu 03/24/2013 12:06 PM, Misa Simic pisze: maybe, SELECT DISTINCT issuer,amount

Re: [GENERAL] Checking for changes in other tables

2013-04-26 Thread Misa Simic
two triggers?. one on eu_loans... and one on persons (if valid eu_loan - cant move...) 2013/4/26 CR Lender crlen...@gmail.com I have two tables with countries and persons living in those countries: create table countries ( codechar(2) not null primary key,

Re: [GENERAL] NOTIFY channel

2013-04-26 Thread Misa Simic
2) notify does not work with pgbouncer (yet), although I have in the past had a private pgbouncer with functioning notify. Is there a plan to make it work? Actually - stupid question - probably not important... But good to know... Listen connection doesn't need to work via pgbouncer...

Re: [GENERAL] is there a way to deliver an array over column from a query window?

2013-04-26 Thread Misa Simic
SELECT DISTINCT a, b, c, array_agg(d) OVER (PARTITION BY c ) FROM ( SELECT a, b, c, d FROM testy where e 'email' and c='1035049' ORDER BY a, b, c, e ) t Doesnt give u desired result? On Friday, April 26, 2013, Rafał Pietrak wrote: W dniu 04/26/2013 05:25 PM, Tom Lane pisze:

Re: [GENERAL] Optimizing bulk update performance

2013-04-27 Thread Misa Simic
Hi, If dataset for update is large... Maybe best would be: From client machine, instead of sending update statements with data - export data to file ready for copy command Transfer file to the server where pg is running Make pgsql function which Create temp table Copy to temp from the file

Re: [GENERAL] Optimizing bulk update performance

2013-04-27 Thread Misa Simic
... On Saturday, April 27, 2013, Yang Zhang wrote: On Sat, Apr 27, 2013 at 1:55 AM, Misa Simic misa.si...@gmail.comjavascript:; wrote: Hi, If dataset for update is large... Maybe best would be: From client machine, instead of sending update statements with data - export data

Re: [GENERAL] Optimizing bulk update performance

2013-04-27 Thread Misa Simic
tmp; On Saturday, April 27, 2013, Yang Zhang wrote: On Sat, Apr 27, 2013 at 3:06 AM, Misa Simic misa.si...@gmail.comjavascript:; wrote: I dont know - u can test :) I probably will, but I do have a huge stack of such experiments to run by now, and it's always tricky / takes care to get

[GENERAL] sp-gist vs gist - ltree datatype

2014-09-15 Thread Misa Simic
Hi all, has anyone maybe test sp-gist over ltree datatype? would sp-gist be better option for it? Thanks, Misa

Re: [GENERAL] Why isn't Java support part of Postgresql core?

2014-09-18 Thread Misa Simic
On Thursday, September 18, 2014, cowwoc cow...@bbs.darktech.org wrote: Chris, On 18/09/2014 1:07 AM, Chris Travers wrote: On Wed, Sep 17, 2014 at 9:42 PM, cowwoc cow...@bbs.darktech.org javascript:_e(%7B%7D,'cvml','cow...@bbs.darktech.org'); wrote: Tom, For starters, let's talk

Re: [GENERAL] improving speed of query that uses a multi-column filter ?

2014-09-30 Thread Misa Simic
On Wednesday, October 1, 2014, Jonathan Vanasco postg...@2xlp.com wrote: I'm trying to improve the speed of suite of queries that go across a few million rows. They use 2 main filters across a variety of columns: WHERE (col_1 IS NULL ) AND (col_2 IS NULL) AND ((col_3 IS NULL) OR

[GENERAL] PG94RC1- plv8 functions - problem with input parameter length

2014-11-28 Thread Misa Simic
Hi all, We have found a strange problem with plv8 functions in PG94RC1 PG 9.3 works fine. in PG94RC1 in plv8 functions regardless what function does i.e.nothing CREATE OR REPLACE FUNCTION test.test_text_length_plv8(in_param1 text) RETURNS text AS $BODY$ return 'OK' $BODY$ LANGUAGE plv8; if

Re: [GENERAL] PG94RC1- plv8 functions - problem with input parameter length

2014-11-28 Thread Misa Simic
2014-11-28 16:56 GMT+01:00 Misa Simic misa.si...@gmail.com: Hi all, We have found a strange problem with plv8 functions in PG94RC1 PG 9.3 works fine. in PG94RC1 in plv8 functions regardless what function does i.e.nothing CREATE OR REPLACE FUNCTION test.test_text_length_plv8(in_param1

Re: [GENERAL] PG94RC1- plv8 functions - problem with input parameter length

2014-11-28 Thread Misa Simic
On Friday, November 28, 2014, Adrian Klaver adrian.kla...@aklaver.com wrote: On 11/28/2014 07:56 AM, Misa Simic wrote: Hi all, We have found a strange problem with plv8 functions in PG94RC1 PG 9.3 works fine. in PG94RC1 in plv8 functions regardless what function does i.e.nothing CREATE

Re: [GENERAL] PG94RC1- plv8 functions - problem with input parameter length

2014-12-01 Thread Misa Simic
On Friday, November 28, 2014, Adrian Klaver adrian.kla...@aklaver.com wrote: On 11/28/2014 12:18 PM, Misa Simic wrote: On Friday, November 28, 2014, Adrian Klaver adrian.kla...@aklaver.com mailto:adrian.kla...@aklaver.com wrote: On 11/28/2014 07:56 AM, Misa Simic wrote: Hi