[GENERAL] optimiser STABLE vs. temp table was: HOWTO caching data across function calls: temporary tables, cursor?

2008-04-01 Thread Ivan Sergio Borgonovo
y confirm that's how the optimiser work or explain the differences between providing a "manual" cache and just declaring a function STABLE? thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- 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] optimiser STABLE vs. temp table was: HOWTO caching data across function calls: temporary tables, cursor?

2008-04-01 Thread Ivan Sergio Borgonovo
On Tue, 01 Apr 2008 11:22:20 -0400 Tom Lane <[EMAIL PROTECTED]> wrote: > Ivan Sergio Borgonovo <[EMAIL PROTECTED]> writes: > > I can't really appreciate the difference... or better... I think > > the difference may be that I can't take for granted the function

[GENERAL] still on techniques to cache table slices was: optimiser STABLE vs. temp table

2008-04-01 Thread Ivan Sergio Borgonovo
On Tue, 1 Apr 2008 18:32:25 +0200 Martijn van Oosterhout <[EMAIL PROTECTED]> wrote: > On Tue, Apr 01, 2008 at 06:06:35PM +0200, Ivan Sergio Borgonovo > wrote: > > Would you please be so kind to rephrase: > > > > http://www.postgresql.org/docs/8.1/interactive/xf

[GENERAL] is it helpful for the optimiser/planner to add LIMIT 1

2008-04-03 Thread Ivan Sergio Borgonovo
eg. select a, b from myfunction(3,5) limit 1; select into a,b x,y from tablename where z=5 and u=7 limit 1; select a,b from from tablename where z=5 and u=7 limit 1; thx -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To

Re: [GENERAL] is it helpful for the optimiser/planner to add LIMIT 1

2008-04-03 Thread Ivan Sergio Borgonovo
else other than stopping earlier? Summarising it up: is it worth to add it here and there as an optimisation flag? thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- 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] creating a temp table in a function

2008-04-04 Thread Ivan Sergio Borgonovo
sql > sessions (using the -c flag), I get no error. Is this expected > behavior? If so, why? http://www.postgresql.org/docs/faqs.FAQ.html#item4.19 ? -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make cha

Re: [GENERAL] Quoting table/column names vs performance

2008-04-09 Thread Ivan Sergio Borgonovo
7;myrow'] If you used camel case in pg without quotes it will be a pain. - Some pg functions aren't case-proof eg. pg_get_serial_sequence I'm thinking to write a script to quote all identifiers... but I'm worried it will look to much as a parser rather than a simple sed script

[GENERAL] SQL injection, php and queueing multiple statement

2008-04-11 Thread Ivan Sergio Borgonovo
Is there a switch (php side or pg side) to avoid things like: pg_query("select id from table1 where a=$i"); into becoming pg_query("select id from table1 where a=1 and 1=1; do something nasty; -- "); So that every pg_query(...) can contain no more than one statement? tha

Re: [GENERAL] SQL injection, php and queueing multiple statement

2008-04-11 Thread Ivan Sergio Borgonovo
er. Up to my knowledge blind sql injection requires a lot of statement and a lot of errors that will end up in my logs so I'll have a chance to fix the error etc... Prepared statements does not fit with part of the framework I'm working with. And still I'm looking for a security

Re: [GENERAL] SQL injection, php and queueing multiple statement

2008-04-12 Thread Ivan Sergio Borgonovo
ce solutions It is exactly that false sense of security I'm trying to fight, placing several barriers on the way of a potential attacker. Being able to stop queued statements seemed a cheap barrier but with a reasonably good ROI. -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sen

Re: [GENERAL] SQL injection, php and queueing multiple statement

2008-04-12 Thread Ivan Sergio Borgonovo
On Sat, 12 Apr 2008 12:39:38 -0400 Tom Lane <[EMAIL PROTECTED]> wrote: > Ivan Sergio Borgonovo <[EMAIL PROTECTED]> writes: > > I may sound naive but having a way to protect the DB from this > > kind of injections looks as a common problem, I'd thought there &

Re: [GENERAL] SQL injection, php and queueing multiple statement

2008-04-12 Thread Ivan Sergio Borgonovo
le or nonsensical to hope to have a switch that will enable/disable multiple statements for each call to pg_query? On Sat, 12 Apr 2008 20:52:11 +0200 "Dawid Kuroczko" <[EMAIL PROTECTED]> wrote: [some good advices] Yep... I'm already doing my best at it. Working with libraries

Re: [GENERAL] SQL injection, php and queueing multiple statement

2008-04-13 Thread Ivan Sergio Borgonovo
Apr 2008 00:13:49 +0100 Sam Mason <[EMAIL PROTECTED]> wrote: > On Sat, Apr 12, 2008 at 11:06:42PM +0200, Ivan Sergio Borgonovo > wrote: > > But what about already written code that use pg_query? > > If you rewrite the database interface then it doesn't matter, the >

Re: [GENERAL] SQL injection, php and queueing multiple statement

2008-04-13 Thread Ivan Sergio Borgonovo
; all else fails and will block a many of the most flexible types of > SQL injection attack. I just think that if it exists it needs to be > opt-out, not opt-in, to be significantly effective as a defense > against other programming errors. thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- 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] SQL injection, php and queueing multiple statement

2008-04-13 Thread Ivan Sergio Borgonovo
On Sun, 13 Apr 2008 11:49:58 +0200 Martijn van Oosterhout <[EMAIL PROTECTED]> wrote: > On Sun, Apr 13, 2008 at 10:37:52AM +0200, Ivan Sergio Borgonovo > wrote: > > > Because you appear to be seeking something to protect against > > > programmers who do not foll

Re: [GENERAL] Unacceptable postgres performance vs. Microsoft sqlserver

2008-04-14 Thread Ivan Sergio Borgonovo
would be a bad idea to draw any conclusions > based on the performance of "select count(*) from some_table;" But why once you add the index and count distinct the performances are still so far? I'd say that counting in this case is not the hardest thing to do, but rather the "di

Re: [GENERAL] Unacceptable postgres performance vs. Microsoft sqlserver

2008-04-14 Thread Ivan Sergio Borgonovo
On Mon, 14 Apr 2008 21:30:15 +0100 Gregory Stark <[EMAIL PROTECTED]> wrote: > "Ivan Sergio Borgonovo" <[EMAIL PROTECTED]> writes: > > > But why once you add the index and count distinct the performances > > are still so far? > > I'd say that c

[GENERAL] Debian etch, backport postgresql 8.3 experiences?

2008-04-23 Thread Ivan Sergio Borgonovo
led the previous version? etc... -- Ivan Sergio Borgonovo http://www.webthatworks.it -- 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] Debian etch, backport postgresql 8.3 experiences?

2008-04-23 Thread Ivan Sergio Borgonovo
On Wed, 23 Apr 2008 12:04:08 +0200 Peter Eisentraut <[EMAIL PROTECTED]> wrote: > Am Mittwoch, 23. April 2008 schrieb Ivan Sergio Borgonovo: > > I'd like to know if anyone has experience in using postgresql 8.3 > > for amd64. > > There are probably thousands of p

[GENERAL] taking actions on rollback (PHP)

2008-04-26 Thread Ivan Sergio Borgonovo
et rolled back... but the pg_query('commit;') statement always succede so the cleanup never get executed. How am I going to see if the transaction succeeded without checking what happens for each statement and getting the cleanup code execute? thanks -- Ivan Sergio Borgonovo http://www

Re: [GENERAL] taking actions on rollback (PHP)

2008-04-26 Thread Ivan Sergio Borgonovo
On Sat, 26 Apr 2008 23:14:07 +0200 Martijn van Oosterhout <[EMAIL PROTECTED]> wrote: > On Sat, Apr 26, 2008 at 10:52:12PM +0200, Ivan Sergio Borgonovo > wrote: > > How am I going to see if the transaction succeeded without > > checking what happens for each statement

Re: [GENERAL] taking actions on rollback (PHP)

2008-04-27 Thread Ivan Sergio Borgonovo
On Sat, 26 Apr 2008 20:58:06 -0600 "Scott Marlowe" <[EMAIL PROTECTED]> wrote: > On Sat, Apr 26, 2008 at 4:19 PM, Ivan Sergio Borgonovo > <[EMAIL PROTECTED]> wrote: > > > > With the added @ everything seemed to be OK. > > No, the @ is just making ph

Re: [GENERAL] taking actions on rollback (PHP)

2008-04-27 Thread Ivan Sergio Borgonovo
k and saved to DB. Then control is passed to me and I add the other proprieties. If for any reason my code fail... I've to cleanup the simpler object created by the framework "by hand". Using transactions on my part won't solve the problem that the framework is not t

[GENERAL] storing long live parameters

2008-05-06 Thread Ivan Sergio Borgonovo
s as immutable even if they are not and refresh their values cycles of "create or replace"... if they actually get refreshed... but I'd like to see if there are other options. thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgs

choiche of function language was: Re: [GENERAL] dynamic procedure call

2008-05-10 Thread Ivan Sergio Borgonovo
clear what is at least one of the advantage of plpython or plperl over plpgsql, but then what are the advantages of plpgsql over the rest of the crowd other than resembling the language used in Oracle? -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list

Re: [GENERAL] Returning RECORD from PGSQL without custom type?

2008-05-10 Thread Ivan Sergio Borgonovo
ense to everyone? It would make > programming set returning record functions a lot easier. yeah it could be a nice shortcut to define types "locally". Once you call "OUT" the type, you could avoid the ret1:=row. -- Ivan Sergio Borgonovo http://www.webthatworks.it -- 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] Couple of question on functions

2008-05-14 Thread Ivan Sergio Borgonovo
replace function ft(out a1 int, out a2 int) as $$ begin select into a1 a from t1 limit 1; for i in 1..7 loop end loop; select into a2 a from t1 limit 1; return; end; $$ language plpgsql; select * from ft(); update t1 set a=5; So I'd expect ft() return always (1,1) or (5,5). Since

[GENERAL] sp: error message not coherent with actual code

2008-05-15 Thread Ivan Sergio Borgonovo
line 71 at SQL statement SQL statement "SELECT b2c._OrderGroupID from Basket2Order( $1 ) as b2c" ? Commenting that line the error goes away. -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes t

Re: [GENERAL] sp: error message not coherent with actual code

2008-05-15 Thread Ivan Sergio Borgonovo
On Thu, 15 May 2008 20:36:21 +0200 Ivan Sergio Borgonovo <[EMAIL PROTECTED]> wrote: > I've this line in a sp: > > select into _OrderGroupID b2c._OrderGroupID from > Basket2Order(_BasketID) as b2c; > > but I get this error: > > SELECT query has no destinatio

[GENERAL] Postgresql MVCC, Read Committed Isolation Level and taking "snapshot"

2008-05-16 Thread Ivan Sergio Borgonovo
ANSACTION ISOLATION LEVEL SERIALIZABLE what I'm looking for? -- Ivan Sergio Borgonovo http://www.webthatworks.it -- 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] Postgresql MVCC, Read Committed Isolation Level and taking "snapshot"

2008-05-18 Thread Ivan Sergio Borgonovo
On Fri, 16 May 2008 09:55:56 -0400 Andrew Sullivan <[EMAIL PROTECTED]> wrote: > On Fri, May 16, 2008 at 09:06:11AM +0200, Ivan Sergio Borgonovo > wrote: > > Is > > BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE > > what I'm looking for? > Yes. Perfect,

Re: [GENERAL] Postgresql MVCC, Read Committed Isolation Level and taking "snapshot"

2008-05-20 Thread Ivan Sergio Borgonovo
On Fri, 16 May 2008 09:55:56 -0400 Andrew Sullivan <[EMAIL PROTECTED]> wrote: > On Fri, May 16, 2008 at 09:06:11AM +0200, Ivan Sergio Borgonovo > wrote: > > Is > > BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE > > what I'm looking for? > > Yes. OK

Re: [GENERAL] Postgresql MVCC, Read Committed Isolation Level and taking "snapshot"

2008-05-21 Thread Ivan Sergio Borgonovo
On Tue, 20 May 2008 17:04:25 -0400 Andrew Sullivan <[EMAIL PROTECTED]> wrote: > On Tue, May 20, 2008 at 08:56:41PM +0200, Ivan Sergio Borgonovo > wrote: > > > I just would like to have a coherent snapshot of some tables. > > If you have a multi-statement transacti

Re: [GENERAL] Multiple result sets

2008-06-01 Thread Ivan Sergio Borgonovo
erializable > isolation. Which one will fail? the second query or the serializable transaction. My understanding was that the serializable transaction will fail. -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postg

[GENERAL] table "inheritance" and uniform access

2008-06-24 Thread Ivan Sergio Borgonovo
out of a DB system and it makes me think I still have to earn my DBA black belt and maybe it's time to rewrite the schema. I'm trying to force all this stuff in the DB rather than on the client code since this code should be wrapped in a serializable transaction. I can't see any way t

Re: [GENERAL] optimize/cleanup SQL

2009-05-29 Thread Ivan Sergio Borgonovo
T(EPOCH FROM clockin))/3600 AS NUMERIC),2) AS > hours FROM timeclock; satisfying? template1=# select extract(days from ('2009-01-01'::timestamp - '2008-01-01'::timestamp))+5::int; ?column? -- 371 (1 row) -- Ivan Sergio Borgonovo http://www.webthatworks.it -

[GENERAL] why dropping a trigger may cause a deadlock

2009-06-05 Thread Ivan Sergio Borgonovo
nterfere with the deadlocked one and at that moment the write activity on the table on which the triggers are acting is minimal if not absent. But I suspect my understanding of how these things work is very naive... so some general clue would be appreciated as well. -- Ivan Sergio Borgonovo

Re: [GENERAL] why dropping a trigger may cause a deadlock

2009-06-05 Thread Ivan Sergio Borgonovo
On Fri, 05 Jun 2009 10:46:11 -0400 Tom Lane wrote: > Ivan Sergio Borgonovo writes: > > I've encountered this error for the first time > > psql:./import_stock_scratch.sql:9: ERROR: deadlock detected > > DETAIL: Process 11095 waits for AccessExclusiveLock on relat

Re: [GENERAL] why dropping a trigger may cause a deadlock

2009-06-08 Thread Ivan Sergio Borgonovo
On Fri, 05 Jun 2009 17:35:19 -0400 Tom Lane wrote: > Ivan Sergio Borgonovo writes: > > I don't get it. > > Why dropping the triggers would cause a deadlock anyway? > > > I bet it is due to my naïve view of the problem but I think a > > trigger is a &qu

[GENERAL] simulating high load for vacuum full

2009-06-17 Thread Ivan Sergio Borgonovo
esn't look as a working strategy. The restore shouldn't be fragmented. What are the "side effects" of a vacuum full? Any cheaper way to cause a heavy vacuum full or just its side effects? thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-

[GENERAL] looping over a small record set over and over in a function

2009-06-19 Thread Ivan Sergio Borgonovo
e etc... what about all the UPDATEs involved to change field N+1 of the temp table? Will be they expensive? thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresq

Re: [GENERAL] looping over a small record set over and over in a function

2009-06-20 Thread Ivan Sergio Borgonovo
puted fields that will be used by the next function etc... If this is possible, this way have the advantage to be extensible. I wonder if it is efficient since I don't know if an UPDATE table set where current of cursor on a temp table is going to incur in any disk write. thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] cursors, temp tables, dynamic sql technique (was and is: looping over a small record set over and over in a function)

2009-06-21 Thread Ivan Sergio Borgonovo
On Sun, 21 Jun 2009 10:57:51 +0800 Craig Ringer wrote: > On Fri, 2009-06-19 at 20:23 +0200, Ivan Sergio Borgonovo wrote: > > > If I could easily load all the dataset into an array, loop > > through it and then just update the computed field it would be > > nice... but ho

Re: [GENERAL] cursors, temp tables, dynamic sql technique (was and is: looping over a small record set over and over in a function)

2009-06-21 Thread Ivan Sergio Borgonovo
On Sun, 21 Jun 2009 21:43:16 +0800 Craig Ringer wrote: > On Sun, 2009-06-21 at 14:57 +0200, Ivan Sergio Borgonovo wrote: > > > I think everything could be summed up as: > > > > select into t myaggregate1(field) from dataset where condition1; > > if(t>10) th

Re: [GENERAL] temp tables, sessions, pgpool and disk

2009-06-22 Thread Ivan Sergio Borgonovo
ntially I got the idea that a connection is somehow serial in its execution and that storage could be garbage collected or just released early (drop table, on commit drop). This looks as it is taking temp tables very far from the standard. And yeah... once you want to do memory management/resource manag

Re: [GENERAL] temp tables, sessions, pgpool and disk

2009-06-22 Thread Ivan Sergio Borgonovo
On Mon, 22 Jun 2009 11:40:08 +0200 Martijn van Oosterhout wrote: > On Mon, Jun 22, 2009 at 09:53:59AM +0200, Ivan Sergio Borgonovo > wrote: > > > The OS knows much less about what anonymous memory (memory not > > > backed by a file) "means" to a program an

[GENERAL] drawback of array vs join

2009-06-23 Thread Ivan Sergio Borgonovo
0 = any itemgroups ... itemlisttemp tables will be very small (30 as an upper limit) and arrays as well will contain very few elements (4 as an upper limit). I'm aware of the drawback of de-normalization. Should I be aware of anything else when using arrays this way? thanks -- Iva

Re: [GENERAL] drawback of array vs join

2009-06-23 Thread Ivan Sergio Borgonovo
On Tue, 23 Jun 2009 17:39:46 -0300 Emanuel Calvo Franco wrote: > 2009/6/23 Ivan Sergio Borgonovo : > > I've a temporary table where I'd like to resume data coming from > > several other tables (normalised the usual way). > > eg. > > a list of items that

[GENERAL] Replication and coding good practices

2009-06-28 Thread Ivan Sergio Borgonovo
ork with a "general" replication solution? The applications I mostly deal with are e-commerce sites. -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresq

Re: [GENERAL] Replication and coding good practices

2009-06-29 Thread Ivan Sergio Borgonovo
schema changes with a hook in svn, but right now it doesn't look as a good investment. Still I'm very interested in techniques to version schema changes and bring them together with code change and being able to diff them. thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Feistel cipher, shorter string and hex to int

2009-07-06 Thread Ivan Sergio Borgonovo
; */ -- ?? l1:=l2; r1:=r2; i:=i+1; END LOOP; return ((l1::bigint<<16) + r1); -- modifying here seems trivial END; $$ LANGUAGE plpgsql strict immutable; Anything else to suggest or copy from? -- Ivan Sergio Borgonovo http://www.webthatworks.it -- 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] combine multiple row values in to one row

2009-07-06 Thread Ivan Sergio Borgonovo
se plpgsql functions, but each time I do it > I have to rewrite the function to customize it. > > Is there a generic way to do this? An aggregate maybe? array_accum http://www.postgresql.org/docs/8.2/static/xaggr.html ? -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via

Re: [GENERAL] Feistel cipher, shorter string and hex to int

2009-07-07 Thread Ivan Sergio Borgonovo
On Tue, 07 Jul 2009 12:07:48 +0200 "Daniel Verite" wrote: > Ivan Sergio Borgonovo wrote: > > > r2:=l1 # 1366.0*r1+150889)%714025)/714025.0)*32767)::int; > > -- but what about this? where does it come from? > > This function: > (1366.0*r1+15088

Re: [GENERAL] PostgreSQL and Poker

2009-07-08 Thread Ivan Sergio Borgonovo
bout licenses and with a better English than mine should correct the comments. -- Ivan Sergio Borgonovo http://www.webthatworks.it -- 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] PostgreSQL and Poker

2009-07-08 Thread Ivan Sergio Borgonovo
On Wed, 8 Jul 2009 13:22:14 -0600 Scott Marlowe wrote: > On Wed, Jul 8, 2009 at 12:27 PM, Ivan Sergio > Borgonovo wrote: > > On Wed, 8 Jul 2009 19:39:16 +0200 > > "Massa, Harald Armin" wrote: > > > >> a quite interesting read. > >> >

[GENERAL] temp tables and replication/connection sharing/pooling

2009-07-08 Thread Ivan Sergio Borgonovo
web application. I'm not planning to use pg_pconnect. thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- 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] Documentation Improvement suggestions

2009-07-20 Thread Ivan Sergio Borgonovo
evious versions in the new version (indicating from which versions they come from). -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] checking for temp tables information_schema vs. EXCEPTION

2009-07-21 Thread Ivan Sergio Borgonovo
o EXCEPTION method doesn't look safe. Does EXCEPTION have some other hidden cost? Just for curiosity. thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Constraint between 2 tables and taking a coherent snapshot of both

2009-07-26 Thread Ivan Sergio Borgonovo
ld like to understand better how to manage this situation so that I could make it as simple as possible AND lower as much as possible the chances that the transaction will have to be rolled back. -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general

Re: [GENERAL] MSSQL to PostgreSQL

2009-07-31 Thread Ivan Sergio Borgonovo
ess-other-PostgreSQL-Databases-and-Servers.html http://www.postgresql.org/docs/8.3/static/dblink.html -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] parameters in functions and overlap with names of columns

2009-08-04 Thread Ivan Sergio Borgonovo
I've create or replace function(... declare col1 varchar(32); ... create table pippo( col1 varchar(32), ... Unfortunately I can't schema specify the column to avoid name overlap. Is there another way other than just simply rename the variable? thanks -- Ivan Sergio Borg

Re: [GENERAL] parameters in functions and overlap with names of columns

2009-08-04 Thread Ivan Sergio Borgonovo
On Tue, 4 Aug 2009 16:01:58 +0200 Pavel Stehule wrote: > 2009/8/4 Ivan Sergio Borgonovo : > > I've > > > > create or replace function(... > > > > declare > >  col1 varchar(32); > > ... > > > >  create table pippo( > >    col1 v

[GENERAL] acl_admin by Afilias CA (bug/feature report)

2009-08-06 Thread Ivan Sergio Borgonovo
rant around? thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- 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] Generating random unique alphanumeric IDs

2009-08-16 Thread Ivan Sergio Borgonovo
at could do as I can't think of how the ideal solution of a ID > > hashing algorithm would be possible. Sometimes ago Daniel Verite posted an implementation of a fiestel cipher in plpgsql. I'm happily using it to generate pseudo-random hex strings. -- Ivan Sergio Borgonovo http:/

[GENERAL] design, plpgsql and sql injection in dynamically generated sql

2009-08-17 Thread Ivan Sergio Borgonovo
ing that was not meant to be seen. One way would be to build up a table of permitted (table, key) and then just pass the table and the key value. What should be the equivalent of quote_ident in PHP? thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing lis

Re: [GENERAL] design, plpgsql and sql injection in dynamically generated sql

2009-08-18 Thread Ivan Sergio Borgonovo
t a "client side" array of permitted table, key to dynamically build the query on the client side. -- Ivan Sergio Borgonovo http://www.webthatworks.it -- 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] design, plpgsql and sql injection in dynamically generated sql

2009-08-18 Thread Ivan Sergio Borgonovo
ere with the text one. thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- 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] Generating random unique alphanumeric IDs

2009-08-20 Thread Ivan Sergio Borgonovo
'a' In the line of select lpad( to_hex(feistel_encrypt(10)),7 , to_hex((rand()*2^31)::int) ); I was wondering if there is any better way to get alphanumeric random string quickly. Since uniqueness is assured by passing a sequence to fesitel_encrypt, I just need turning into to alphanumeric

[GENERAL] "ownership" of sequences, pseudo random unique id

2009-08-20 Thread Ivan Sergio Borgonovo
lter table pr drop column code; or just drop table pr seems to work as expected (they drop the sequence too). Should I be concerned of anything since it looks like a hack? -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org

Re: [GENERAL] Generating random unique alphanumeric IDs

2009-08-20 Thread Ivan Sergio Borgonovo
t embellish the hex with some padding. But if you really need to use letters and be compact and such... I think you're just looking for changing the base of your wathever-pseudo-random algorithm. That's a common problem you may just have to adapt to plpgsql. [1] select s.i, feistel_de

[GENERAL] bayesian classification over tsvector

2009-08-20 Thread Ivan Sergio Borgonovo
ven't been assigned to a group already. thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- 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] "ownership" of sequences, pseudo random unique id

2009-08-21 Thread Ivan Sergio Borgonovo
On Thu, 20 Aug 2009 14:31:02 -0400 Alvaro Herrera wrote: > Ivan Sergio Borgonovo wrote: > > I've > > > > create table pr( > > code varchar(16) primary key, > > ... > > ); > > create sequence pr_code_seq owned by pr.code; -- uh! > >

Re: [GENERAL] Temp table or normal table for performance?

2009-08-21 Thread Ivan Sergio Borgonovo
on't play well with temp tables IME. Why? you mean that since you generally use temp table for computation and looping several times over the table... a more expressive language would be suited? -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing lis

Re: [GENERAL] Ranking search results using multiple fields in PostgreSQL fulltext search

2009-10-12 Thread Ivan Sergio Borgonovo
rder by ts_rank(yourpreviouslycomputedts_vector, yourinput) (or ts_rank_cd) -- Ivan Sergio Borgonovo http://www.webthatworks.it -- 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] Ranking search results using multiple fields in PostgreSQL fulltext search

2009-10-12 Thread Ivan Sergio Borgonovo
l have to add some extra redundancy if you plan to store precomputed ts_vectors for each record. If you need to search "separately" in different fields (eg. title ~ 'gino' AND summary ~ 'pino') you just need to weight the input query as well inputquery := setweight(

Re: [GENERAL] Ranking search results using multiple fields in PostgreSQL fulltext search

2009-10-12 Thread Ivan Sergio Borgonovo
On Mon, 12 Oct 2009 19:26:55 +0530 Gaini Rajeshwar wrote: > Ivan, > If i create a tsvector as you mentioned with concatenation > operator, my search query will search in any of these fields which > are concatenated in my tsvector. > For example, if i create tsvector like

[GENERAL] setweight detailed doc was: Ranking search results using multiple fields in PostgreSQL fulltext search

2009-10-12 Thread Ivan Sergio Borgonovo
p;'); I can't remember what was the meaning of that '&' and I can't find the docs. Could someone point me to a more detailed doc that explain in more details setweight? thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] joining an array with a table or...?

2009-10-26 Thread Ivan Sergio Borgonovo
ot; to do it just in one query. Any clean technique? thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- 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] joining an array with a table or...?

2009-10-26 Thread Ivan Sergio Borgonovo
On Mon, 26 Oct 2009 14:15:26 +0100 Ivan Sergio Borgonovo wrote: > I've a list of emails and a list of users (with emails). > > If the list of emails was already inside a table > > create table mails ( > mail varchar(64) > ); > > create table users ( > nam

Re: [GENERAL] joining an array with a table or...?

2009-10-26 Thread Ivan Sergio Borgonovo
On Mon, 26 Oct 2009 14:56:26 -0400 Merlin Moncure wrote: > On Mon, Oct 26, 2009 at 11:05 AM, Ivan Sergio Borgonovo > wrote: > > To make it more concrete I came up with: > > > > select coalesce(u.mail,j.mail) from ( > >  select (array['m...@example1.co

[GENERAL] design, ref integrity and performance

2009-10-27 Thread Ivan Sergio Borgonovo
ve to generate password/email couples first before filling pw_resource. I could make the constraint deferrable, add a on delete cascade to pw_email.password but: - I'm not sure it is a good design - I'm still not sure it can work as expected Before testing if it can work I'd like to he

Re: [GENERAL] design, ref integrity and performance

2009-10-27 Thread Ivan Sergio Borgonovo
On Tue, 27 Oct 2009 09:17:59 + Richard Huxton wrote: > Ivan Sergio Borgonovo wrote: > > Hi, > > I've to generate unique password and associate them with emails. > > Association with emails is just to mail the password, email + > > password aren't

[GENERAL] still on joining array/inline values was and is: design, ref integrity and performance

2009-10-28 Thread Ivan Sergio Borgonovo
in a temp table and so on... Still before I make any test I need to find how to associate emails with passwords considering that I'd like to pass email "inline" the SQL statement and I'll have the passwords in pw_res. -- Ivan Sergio Borgonovo http://www.webthatworks.it -- 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] still on joining array/inline values was and is: design, ref integrity and performance

2009-10-28 Thread Ivan Sergio Borgonovo
see if you > have any new problems you need to solve. Every issue you've > described so far is database design 101 and should present no real > problem. I think you're agonizing over nothing... That's always a good advice. Sometimes you're out just for moral supp

[GENERAL] pk vs unique not null differences between 8.3.4 and 8.3.8

2009-11-02 Thread Ivan Sergio Borgonovo
.. pg says that the index is needed for shop_commerce_gift_giftcode_key constraint was it something that was fixed between the releases or I just didn't take note of what I really did in the staging box? btw I was using the same pgsql version from my desktop to \d the tables.

[GENERAL] COPY complaining about unquoted carriage return found in data... in a quoted field

2011-05-10 Thread Ivan Sergio Borgonovo
postgres consider quoted field. the content in hex 09 22 56 | 69 61 20 46 | 61 65 6E 74 | 69 6E 61 2C 20 35 33 0D | 0A 22 09 22 | 35 30 30 31 | 34 22 09 \t"Via Faentina, 53\r\n"\t What am I missing? -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general maili

Re: [GENERAL] COPY complaining about unquoted carriage return found in data... in a quoted field

2011-05-10 Thread Ivan Sergio Borgonovo
a field I've to take care of escaping just the quote and the escape characters and the field may contain delimiter characters (field separator and record separator) without escaping. I was wondering if a) the documentation is wrong b) I didn't write a correct \COPY command string c) the

[GENERAL] find the greatest, pick it up and group by

2011-05-16 Thread Ivan Sergio Borgonovo
... end FROM ordiniitem ioi group by ioi.idordine, ioi.grupposped, ioi.idart, ioi.qevasa, ioi.qfuoricat, ioi.qinris, ioi.qnonpub, ioi.qann, ioi.qord, ioi.qpren, ioi.qrichpag, ioi.qinriass, ioi.qinesa ; thanks -- Ivan Sergio Borgono

Re: [GENERAL] COPY complaining about unquoted carriage return found in data... in a quoted field

2011-05-16 Thread Ivan Sergio Borgonovo
On Tue, 10 May 2011 15:59:07 +0200 Ivan Sergio Borgonovo wrote: Sorry for the noise. The csv was automatically generated. The code was right but during generation there was some problem with the box generating it (php segfaulting) and there were some unclosed quotes in a much earlier line

Re: [GENERAL] find the greatest, pick it up and group by

2011-05-16 Thread Ivan Sergio Borgonovo
se it. Of course I'm more interested to know if there is any cleaner solution for 8.3. thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] benchmark comparing different postgresql versions

2011-06-11 Thread Ivan Sergio Borgonovo
Is there a place where I can find comparison in performances of different postgresql versions, hopefully related to new feature/improvements? thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to

Re: [GENERAL] Read MS-SQL data into Postgres via ODBC link?

2011-07-05 Thread Ivan Sergio Borgonovo
ue to Ubuntu-related error. Nice. I'd be interested in some feedback if you succede to make it work. Does this project has any chance to be included in contrib? It seems alive and kicking. -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing l

[GENERAL] Pg multi-tenanted hard? was: FREE hosting platforms with PostgreSQL, Java SDK, Tomcat, ecc.?

2011-08-07 Thread Ivan Sergio Borgonovo
than anything else? -- Ivan Sergio Borgonovo http://www.webthatworks.it -- 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] Pg multi-tenanted hard? was: FREE hosting platforms with PostgreSQL, Java SDK, Tomcat, ecc.?

2011-08-07 Thread Ivan Sergio Borgonovo
On Mon, 08 Aug 2011 05:38:02 +0800 Craig Ringer wrote: > On 7/08/2011 11:43 PM, Ivan Sergio Borgonovo wrote: > > On Sun, 07 Aug 2011 20:41:27 +0800 > > Craig Ringer wrote: > > > >> By the way, one of the reasons you're not finding much free > >> ho

Re: [GENERAL] access to lexems or access to parsed elements

2011-08-25 Thread Ivan Sergio Borgonovo
ql-c-module-turn-tsvectors-tsquery-and-return-tsvectors-tables -- Ivan Sergio Borgonovo http://www.webthatworks.it -- 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] "Too far out of the mainstream"

2012-09-05 Thread Ivan Sergio Borgonovo
DB crash and burn). That's what most people perceive as "the mainstream" if you don't have a big marketing dept lying. -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] unable to avoid a deadlock at the end of a long transaction

2010-05-07 Thread Ivan Sergio Borgonovo
0) then _Authors := _Authors || ', ' || _Name; end if; end loop; return; end; $$ language plpgsql volatile; -- Ivan Sergio Borgonovo http://www.webthatworks.it -- 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] unable to avoid a deadlock at the end of a long transaction

2010-05-07 Thread Ivan Sergio Borgonovo
On Fri, 07 May 2010 10:29:20 -0400 Tom Lane wrote: > Ivan Sergio Borgonovo writes: > > I've been having this: > > psql:include/custom/import_update.custom.sql:63: ERROR: deadlock > > detected DETAIL: Process 13349 waits for AccessExclusiveLock on > > re

Re: [GENERAL] What Linux edition we should chose?

2010-05-31 Thread Ivan Sergio Borgonovo
On a production box? Any experience to share on upgrading from source on Debian? -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Debian: upgrading from was: What Linux edition we should chose?

2010-05-31 Thread Ivan Sergio Borgonovo
7;s going to upgrade Debian from source. So someone may share his recipe and caveats. I was actually thinking to test 9.0 in my /home on some real world DB. That could be a chance to learn how to upgrade from source. -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-ge

<    1   2   3   4   5   6   7   8   >