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

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

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

2014-11-28 Thread Misa Simic
On Friday, November 28, 2014, Adrian Klaver 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 regardles

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 : > 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

[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 len

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 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 > (col_3 =

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

2014-09-18 Thread Misa Simic
On Thursday, September 18, 2014, cowwoc wrote: > Chris, > > On 18/09/2014 1:07 AM, Chris Travers wrote: > > On Wed, Sep 17, 2014 at 9:42 PM, cowwoc > wrote: > >> Tom, >> >> For starters, let's talk strictly about improving the deployment >> situation, which the core team *is* uniquely positione

[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] Grouping, Aggregate, Min, Max

2013-12-16 Thread Misa Simic
2013/12/13 Kevin Grittner > Misa Simic 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 func

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

2013-12-13 Thread Misa Simic
es : > 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 > >> Hi All, >> >> I am not sure how to define with words what I wa

[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 8

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 > > 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 position. That is, each >

Re: [GENERAL] Storing small image files

2013-05-10 Thread Misa Simic
2013/5/10 Eduardo Morras > > 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 wrote: > > OK, this is kind of convoluted, but I got a couple of test cases that > work > > for me. The steps to make the first one a

Re: [GENERAL] Storing small image files

2013-05-09 Thread Misa Simic
und a solution that meets my immediate need. > > Thanks! > > > On Thu, May 9, 2013 at 12:31 PM, Misa Simic wrote: > >> >> >> >> 2013/5/9 Nelson Green >> >>> Thanks Karl, but I'm trying to do this from a psql shell. I can't use >

Re: [GENERAL] Storing small image files

2013-05-09 Thread Misa Simic
2013/5/9 Nelson Green > 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 wrote: > >> On 5/9/2013 11:12 AM, Karl Denninger wrote: >> >> On 5/9/2013 10:51 AM, Achilleas Mantzios wrote: >> >>

Re: [GENERAL] Optimizing bulk update performance

2013-04-27 Thread Misa Simic
oo.id); INSERT INTO foo SELECT * FROM tmp; On Saturday, April 27, 2013, Yang Zhang wrote: > On Sat, Apr 27, 2013 at 3:06 AM, Misa Simic > > > wrote: > > I dont know - u can test :) > > I probably will, but I do have a huge stack of such experiments to run > by now, an

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 > > > wrote: > > Hi, > > > > If dataset for update is large... > > > > Maybe best would be: > > > > From client machine, instead of sending u

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 Up

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] 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... Tha

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 > I have two tables with countries and persons living in those countries: > > create table countries ( > codechar(2) not null primary key, > eu bo

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

2013-04-25 Thread Misa Simic
ER (PARTITION BY c ) FROM ( SELECT 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 > W dniu 03/24/2013 12:11 PM, Rafał Pietrak pisze: > > W dniu 03/24/2013 12:06 PM, Misa Simic pi

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 wit

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 no

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] 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, Jul

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... Person_

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

2013-03-29 Thread Misa Simic
day, March 28, 2013, Jasen Betts wrote: > On 2013-03-27, Misa Simic > wrote: > > --20cf3074d6a0c370ce04d8ef50c1 > > Content-Type: text/plain; charset=UTF-8 > > > > Hi Clemens, > > > > Well, I am not sure what you mean by polling... > > > > But Examp

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 gue

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 > Hi Bill, > > >> Is there any way to listen to NOTIFY in ph

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 (row_number)

Re: [GENERAL] PostgreSQL and VIEWS

2013-03-25 Thread Misa Simic
(indexed_column) - does not! Logically - that are the same queries... Thanks, Misa 2013/3/26 Merlin Moncure > On Mon, Mar 25, 2013 at 4:32 PM, Misa Simic wrote: > > Thanks Merlin, > > > > Well... sorry, It could be and my bad english... but let me explain > &g

Re: [GENERAL] PostgreSQL and VIEWS

2013-03-25 Thread Misa Simic
the problem with that :) We have the problem with: SELECT c.* FROM 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 > On Sat, Mar 23,

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 > 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 use within a query > WI

Re: [GENERAL] PostgreSQL and VIEWS

2013-03-24 Thread Misa Simic
> > http://www.sergefonville.nl > > Convince Microsoft! > They need to add TRUNCATE PARTITION in SQL Server > > https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table > > > 2013/3/24 Misa Simic > >> HI, >> &g

[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 conc

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

2013-03-22 Thread Misa Simic
/3/22 Misa Simic > correction: > > > 2013/3/22 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.

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

2013-03-22 Thread Misa Simic
correction: 2013/3/22 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 :) > >

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] 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] 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 value

Re: [GENERAL] partial time stamp query

2013-02-05 Thread Misa Simic
ble = 'tsoil_avg1_sc' GROUP 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:

Re: [GENERAL] partial time stamp query

2013-02-04 Thread Misa Simic
:00 1 2010-07-07 00:45:00 > cfc closed a2 tsoil_sc tsoil_avg1_sc 20.8 20.792370605 > > 2010-07-07_01:00:00_b4warm_a 2010-07-07 01:00:00 1 2010-07-07 01:00:00 > cfc closed a2 tsoil_sc tsoil_avg1_sc 20.72 20.713133545 > > 2010-07-07_01:15:00_b4warm_a 2010-07-07 01:00:00 1 2

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-0

[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, s

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 > Misa Simic writes: > > We have a bit strange error with pljava deploy and postgresql 9.2.1... > >

[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 paramet

[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, Septe

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

2012-09-06 Thread Misa Simic
log author :) 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 >: > >

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 b

Re: [GENERAL] crosstab

2012-09-04 Thread Misa Simic
Excellent :) Thanks - looks as acceptable workaround... Many thanks, Misa 2012/9/5 Joe Conway > 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

Re: [GENERAL] crosstab

2012-09-04 Thread Misa Simic
t returns real v8 object, and methods of that object can be called :) Sorry, Misa 2012/9/5 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 s

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 return

Re: [GENERAL] crosstab

2012-09-04 Thread Misa Simic
, Misa 2012/9/4 Aram Fingal > > 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 t

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] 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] 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 > 1) Copy tables from Administrative to Application:

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] 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 > > From: pgsql-general-ow...@postgresql.org [mailto: > pgsql-general-ow...@postgresql.org] On Behalf Of Misa Simic > Sent: Friday, Jun

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

[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] 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 >

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

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: $dbh->beginTransac

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 > CURRENT_

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 be:

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 no

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 pre

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 > Thank you. > > > the point is - it is not possible to get unknown

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 that

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 i

Re: [GENERAL] Triggering a function on table overwrite

2012-02-06 Thread Misa Simic
t 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 > On Mon, Feb 6, 2012 at 8:42 PM, Thomas Kellerer > wrote: > > Misa Simic, 06.02.2012 10:35: > > &g

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: Bo

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 > In response to Misa Simic : > > > > But maybe it would be better to reorgan

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...) Dep

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 par

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: SEL

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] 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 = ROW_COUNT RETURN Kind regards, Misa Sent from my Windows Phone -- From: Kevin Duffy Sent: 06/01/2012 06:21 To: pgsql-general@postgresql.org Subject: [GENER

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] [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 t

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: pgsql-general

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 f

[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] 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 rem

Re: [GENERAL] unique across two tables

2011-06-22 Thread Misa Simic
t; > Other caveats and restrictions to the current inheritance implementation > can be found in section 5.8 (Inheritance) of the documentation. It is in > the “Data Definition” chapter. > > ** ** > > David J. > > ** ** > > ** ** > > *From:* pgsql-

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 o

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 > Hi list > > I use PostgreSQL 8.4.4. (with Postgis 1.4) > > I have a simple update query that takes hours to run. >

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 Val

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] pervasiveness of surrogate (also called synthetic) keys

2011-05-04 Thread Misa Simic
2011/5/4 Merlin Moncure > 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 invo

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

2011-05-04 Thread Misa Simic
2011/4/28 Merlin Moncure > On Thu, Apr 28, 2011 at 12:29 PM, Jim Irrer 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 -CustomerID -Currency