Re: [GENERAL] problem with serial data type and access

2008-05-16 Thread Ottavio Campana
Adrian Klaver ha scritto: The fact is that the serial data type is in pratice an integer, and when I also try to connect with pgadminIII I see an integer data type and not a serial. I think that since it sees an integer, it does not understand that it is a serial, and access does not recognize it

Re: [GENERAL] problem with serial data type and access

2008-05-15 Thread Ottavio Campana
Scott Marlowe ha scritto: On Thu, May 15, 2008 at 7:54 AM, Ottavio Campana <[EMAIL PROTECTED]> wrote: I know it's not fully IT with the list, but maybe somebody can help me. I'm dealing with this scenario: access 97 is connected through odbc to a postgresql server. All tab

[GENERAL] problem with serial data type and access

2008-05-15 Thread Ottavio Campana
I know it's not fully IT with the list, but maybe somebody can help me. I'm dealing with this scenario: access 97 is connected through odbc to a postgresql server. All tables are saved in postgresql and access is used only to generated the program interface. Everything works fines, but I'm ha

Re: [GENERAL] question about join

2008-05-01 Thread Ottavio Campana
Osvaldo Kussama ha scritto: To further explain, the following query selects both the rows from the join where id_ref_first_tab has the desired value and default_value = true, while I want to select the row corresponding to default_value = true only in case no row corresponding to id_ref_first_ta

[GENERAL] question about join

2008-05-01 Thread Ottavio Campana
Hi, I'm having a problem trying to write a query using join, and I hope you can give me a hint. suppose you have a three tables like these: create table first_table ( id serial primary key, description1 text); create table second_table ( id serial primary key, d

[GENERAL] problem with tsearch and utf-8 on postgresql 8.1

2008-04-17 Thread Ottavio Campana
I created a database with locale [EMAIL PROTECTED], and I'm facing a weird problem with tsearch. Let me show it: tmptest=# SELECT * from pg_ts_cfg; ts_name | prs_name |locale -+--+-- default_russian | default | ru_RU.KOI8-R simple | de

[GENERAL] executing a procedure with delay

2007-12-12 Thread Ottavio Campana
I'd like to execute a stored procedure in postgresql one minute after a table has been modified. In case there are two changes in less than one minute, I want to reset the time that has to be waited before running the procedure. I think I need to use a trigger, but I don't know how... Can you hel

Re: [GENERAL] Read-only availability of a standby server?

2007-11-22 Thread Ottavio Campana
Stefan Kaltenbrunner ha scritto: > Garber, Mikhail wrote: >> In the high-availabilty situation with a warm standby, is it possible (or >> planned) to be able to make standby readable? >> This is a new feature in Oracle 11 and it is very important for a project I >> am working on. > > yeah there

[GENERAL] maximum size of plpgsql function parameter

2007-11-21 Thread Ottavio Campana
I want to pass some text to a function which is going to store it for some tsearch queries. Is there a limit on the length of the text I can pass to a function? -- Non c'e' piu' forza nella normalita', c'e' solo monotonia. signature.asc Description: OpenPGP digital signature

Re: [GENERAL] stripping HTML, SQL injections ...

2007-11-15 Thread Ottavio Campana
Alvaro Herrera ha scritto: > Martin Gainty escribió: >> this is a very simple html tag strip routine >> I dont understand what security you had in mind .. >> >> so I take it you're not a fan of dojo or GWT? > > Let's say the user disables javascript on the browser? or more easily, an attacker can

[GENERAL] create visual query in web applications

2007-10-02 Thread Ottavio Campana
Do you know any library or application so that a user could create visually a query in a web application? I think that now with ajax and web 2.0 it should be possible, but I don't know any product that does it. signature.asc Description: OpenPGP digital signature

Re: [GENERAL] question about pg_dump -a

2007-09-28 Thread Ottavio Campana
Vivek Khera ha scritto: > > On Sep 28, 2007, at 9:07 AM, Ottavio Campana wrote: > >> But why does pg_dump does not already exports data such that previous >> tables do not depend on successive ones? > > Because you can't always sort your tables that way. The re

Re: [GENERAL] question about pg_dump -a

2007-09-28 Thread Ottavio Campana
Richard Huxton ha scritto: > Ottavio Campana wrote: >> >> Is there a way to export tables in order, so that dependencies are >> always met? reading the manpage of pg_dump I found the -Fc flag, but I >> haven't understood if it is good for me and how it work

[GENERAL] question about pg_dump -a

2007-09-27 Thread Ottavio Campana
I have a database which I create using dia and tedia2sql. I developed another version with more tables, without changing anything that was already present in the first version. Now I want to copy the data from one database to another, so I thought about pg_dump -a, assuming that since there is no

Re: [GENERAL] "not in" clause too slow?

2007-09-25 Thread Ottavio Campana
Alban Hertroys ha scritto: > Ottavio Campana wrote: >> 2) how can I speed it up? by using indexes? or by changing the query? > > Do you have indices on mytable.id and copy_mytable.id? > Does using NOT EXISTS get you any better results? Eventually I had to select not all the tab

Re: [GENERAL] "not in" clause too slow?

2007-09-21 Thread Ottavio Campana
Alban Hertroys ha scritto: > Ottavio Campana wrote: >> 2) how can I speed it up? by using indexes? or by changing the query? > > Do you have indices on mytable.id and copy_mytable.id? > Does using NOT EXISTS get you any better results? mytable.id is primary key. I create

[GENERAL] "not in" clause too slow?

2007-09-21 Thread Ottavio Campana
mytable has 1857 rows, copy_mytable is a copy of mytable and I want to know which new rows have been entered. I used the where id not in, and the query works. My problem is that if I run the same command on another table with 378415 rows, it is terribly slow. I ran explain analyze on the first tabl

Re: [GENERAL] queston about locking

2007-09-21 Thread Ottavio Campana
Albe Laurenz ha scritto: > Ottavio Campana wrote: >> I'm writing a python script to update some tables in a db. My >> problem is >> that I need to lock a couple of tables, perform several operations and >> read the corresponding output. >> >> I was t

[GENERAL] queston about locking

2007-09-21 Thread Ottavio Campana
I'm writing a python script to update some tables in a db. My problem is that I need to lock a couple of tables, perform several operations and read the corresponding output. I was thinking about lock in exclusive mode, but in the documentation I found that it is valid only in a transaction. But s

Re: [GENERAL] get a list of table modifications in a day?

2007-09-13 Thread Ottavio Campana
hubert depesz lubaczewski ha scritto: > On Thu, Sep 13, 2007 at 09:59:30AM +0200, Ottavio Campana wrote: >> 1) pg_dump each day and run diff > > it will become increasingly painful as the table size increases. > >> 2) modify some triggers we use and store the info

[GENERAL] get a list of table modifications in a day?

2007-09-13 Thread Ottavio Campana
I need to generate a diff (or something similar) of a table, day by day. What is the best way to tack insert/update/delete operations? I have two ideas, and I'd like to hear your opinion: 1) pg_dump each day and run diff 2) modify some triggers we use and store the information in another table I

[GENERAL] do you have an easy example of postgis and mapserver?

2007-08-21 Thread Ottavio Campana
Hi, I'm sorry this mail is not very in topic, but I hope you can help me. I'm trying to learn how postgis and mapserver work together, but I cannot understand nearly anything. I mean, I read the documentation of postgis and I think I understood it, but I cannot do anything useful with it. What I

[GENERAL] memory leakage in libpg?

2007-07-19 Thread Ottavio Campana
I'm developing a program in C that acquires data from an I/O card and stores values in postgresql. I noticed that the program uses more and more ram, so I decided to debug it with valgrind, and I found ==28449== 156 (36 direct, 120 indirect) bytes in 1 blocks are definitely lost in loss record 2

Re: [GENERAL] about cursors

2007-06-16 Thread Ottavio Campana
Martijn van Oosterhout wrote: >> One last question: what happens to unclosed cursors? I mean, suppose an >> application opens a cursor and crashes. What happens to that cursor? Is >> there a way to close idle cursors? > > Cursors are attached to the transactio and session, if either ends, the > cu

[GENERAL] about cursors

2007-06-16 Thread Ottavio Campana
I never used cursors before, and I'm trying to understand how to use them well. Postgresql doc says "a cursor that encapsulates the query, and then read the query result a few rows at a time." So, when I open a cursor, is all the query executed and results are returned a few a time? My doubt come

[GENERAL] automatically execute a function each day

2007-06-10 Thread Ottavio Campana
I want to execute a function automatically every day, let's say at midnight. Can I do it directly in postgresql, or do I have to use some external programs (cron?) ? Thanks. -- Non c'e' piu' forza nella normalita', c'e' solo monotonia. signature.asc Description: OpenPGP digital signature

Re: [GENERAL] shut down one database?

2007-05-31 Thread Ottavio Campana
Joshua D. Drake wrote: > Ottavio Campana wrote: >> Bill Moran wrote: >>> Ottavio Campana <[EMAIL PROTECTED]> wrote: >>>> I have postgresql running several databases. I can stop them all by >>>> stopping postgresql, but sometimes I'd like to shut

Re: [GENERAL] shut down one database?

2007-05-31 Thread Ottavio Campana
Bill Moran wrote: > Ottavio Campana <[EMAIL PROTECTED]> wrote: >> I have postgresql running several databases. I can stop them all by >> stopping postgresql, but sometimes I'd like to shut down a single database. >> >> Can I get the same effect of sto

[GENERAL] shut down one database?

2007-05-31 Thread Ottavio Campana
I have postgresql running several databases. I can stop them all by stopping postgresql, but sometimes I'd like to shut down a single database. Can I get the same effect of stopping postgresql for only one database? -- Non c'e' piu' forza nella normalita', c'e' solo monotonia. signature.asc D

Re: [GENERAL] tokenize string for tsearch?

2007-05-11 Thread Ottavio Campana
Magnus Hagander wrote: >> I'm using 8.1.8 and I don't find plainto_tsquery in tsearch2.sql >> >> What can I do? > > Yeah, you need 8.2 for that function. I don't think anybody has tried > backpatching it, but if you want to you can look at the code in 8.2 and > see if you can backpatch it yourself

Re: [GENERAL] tokenize string for tsearch?

2007-05-10 Thread Ottavio Campana
Magnus Hagander wrote: > On Mon, May 07, 2007 at 05:31:02PM -0700, Ottavio Campana wrote: >> Hi, I'm trying to use tsearch2 for the first time and I'm having a >> problem setting up a query >> >> If I execute >> >> SELECT * from test_table wher

[GENERAL] tokenize string for tsearch?

2007-05-07 Thread Ottavio Campana
Hi, I'm trying to use tsearch2 for the first time and I'm having a problem setting up a query If I execute SELECT * from test_table where ts_desc @@ to_tsquery ('hello&world'); it works, but I'm having the problem that the string used for the query is not 'hello&world' but 'hello world', Moreove

[GENERAL] change the stop words file for tsearch2

2007-05-07 Thread Ottavio Campana
How can I change the name of the file with the stop words used by tsearch2? I tried searching in the pg_ts_* tables, but I didn't find anything. Moreover, suppose you have a table with (text,ts_vector,boolean) columns. Do you think it might be possible to use two different files of stop words, in

Re: [GENERAL] concurrency in stored procedures

2007-03-23 Thread Ottavio Campana
Ottavio Campana wrote: > Anyway, apart from a couple of errors in the code i wrote (an in isn't > closed and exception handling is not correctly written), can I be sure > that the code in the sub-block works an a snapshot of the db? It seems not to work, I put it into my applica

Re: [GENERAL] concurrency in stored procedures

2007-03-23 Thread Ottavio Campana
Merlin Moncure wrote: > On 3/23/07, Ottavio Campana <[EMAIL PROTECTED]> wrote: >> Ottavio Campana wrote: >> > What would you to in order to be sure that one function or a part of it >> > is atomically executed? >> >> would it be correct something like?

Re: [GENERAL] concurrency in stored procedures

2007-03-23 Thread Ottavio Campana
Ottavio Campana wrote: > What would you to in order to be sure that one function or a part of it > is atomically executed? would it be correct something like? or how would you write this? create or replace function my_function () returs integer as $$ declare ... status boolean; ...

[GENERAL] concurrency in stored procedures

2007-03-23 Thread Ottavio Campana
Hi, using constraints on tables I was able to remove some race conditions, because the unique index prevents the same data to be inserted twice into the table. But I still didn't fix all the race conditions, because in some functions I have to modify more than one table or I just have read and wr

[GENERAL] questions about query design

2007-03-21 Thread Ottavio Campana
Hi, I'm trying to implement some stored procedures but I'm having some doubts, and I'd like to ask you if I'm doing well or not. Here's an example of what I'm doing: I have a table like create table ( id serial, description text not null, active boolean default true); What I want to do is

[GENERAL] blocking function in PL/Python

2006-11-09 Thread Ottavio Campana
suppose we have a stored procedure written in PL/Python. What happens if the function blocks for a while? Does the server still works for the other clients? signature.asc Description: OpenPGP digital signature

Re: [GENERAL] more than 32 parameters to a function?

2006-10-26 Thread Ottavio Campana
I just implemented the same function using an array holding all the booleans fields describing the objects. It works well. Thank you to all of you. -- Non c'e' piu' forza nella normalita', c'e' solo monotonia. signature.asc Description: OpenPGP digital signature

Re: [GENERAL] more than 32 parameters to a function?

2006-10-26 Thread Ottavio Campana
tables where we store items for an e-commerce site. The problem is that these items might have a lot of peculiarities and more than 40 fields are boolean to fully describe them. Bye > Ottavio Campana wrote: >> I'm writing some stored procedures in pl/pgsql for a database using >>

[GENERAL] more than 32 parameters to a function?

2006-10-26 Thread Ottavio Campana
I'm writing some stored procedures in pl/pgsql for a database using postgresql 7.4.7. I need to write a complex function with 65 arguments, but when I try to run it I get an error complaining that arguments can be up to 32. Is there a way to solve this problem or do I have to try to split the fun

Re: [GENERAL] Ajax/PostgreSQL

2006-08-07 Thread Ottavio Campana
On Sat, Aug 05, 2006 at 08:27:25PM -0300, Jorge Godoy wrote: > Paul M Foster <[EMAIL PROTECTED]> writes: > > Here's an example: The user wants to enter a bill (accounts payable) > > into the system. He first has to pick a vendor. Normally, this would > > entail a PHP page that generates a PostgreS

[GENERAL] plpythonu and type record

2006-07-22 Thread Ottavio Campana
I'm trying to write a stored procedure in python with postgresql 7.4, but I cannot return a record or a setof record. I get this error: ERROR: cannot accept a value of type record Is possible to return a record or am I trying to do something impossible? Thank you signature.asc Description:

[GENERAL] ean code data type

2006-06-07 Thread Ottavio Campana
Is there a data type for ean codes for postgresql 7.4? I found the isbn data type, and I would appreciate something similar for ean codes. Thank you signature.asc Description: OpenPGP digital signature

[GENERAL] libpq for palm?

2006-05-02 Thread Ottavio Campana
Is there a libpq for palm os? That would be great to develop applications. -- Non c'è più forza nella normalità, c'è solo monotonia. signature.asc Description: OpenPGP digital signature

Re: [GENERAL] how to document database

2006-04-08 Thread Ottavio Campana
Kaloyan Iliev ha scritto: > Hi, > > I am not familiar with doxygen, so I can't give you any advice. To me > postgresql_autodoc -d works perfectly. > I am useing version 1.25 of postgresql_autodoc. > > I recevice documentation of the sotred rocedures when I have comments on > them. Then when >

Re: [GENERAL] how to document database

2006-04-07 Thread Ottavio Campana
Kaloyan Iliev wrote: > Hi, > > I'm using postgresql_autodoc. It is perfect for me. And if you have > comments in the database the created document is like real documentation:-) I can't make it work. I'm running Debian etch, and I always get [EMAIL PROTECTED]:/tmp$ postgresql_autodoc -d tost Can'

[GENERAL] how to document database

2006-04-07 Thread Ottavio Campana
I need to document the database I develop so that other people can easily understand how it works. I particularly want to document the stored procedures. By now I've used a javadoc style to document them. I can't use tools like doxygen on them but it is always better than nothing. I'd like to kn

Re: [GENERAL] database design questions

2006-04-04 Thread Ottavio Campana
hubert depesz lubaczewski wrote: > 2) do you think it's possible in a plpgsql procedure select the name of > a table into a variable and use that variable in the query? > possible, but not really good way. read about 'execute' in plpgsql. why isn't it good? I mean, from my point of view

Re: [GENERAL] database design questions

2006-04-04 Thread Ottavio Campana
Alban Hertroys wrote: > Ottavio Campana wrote: > >>> CREATE TABLE person ( >>> id SERIAL, >>> name TEXT >>> ); > > >> how can I do it with a INT8 instead of a INT4? > > > Do you really expect that sequence

[GENERAL] database design questions

2006-04-03 Thread Ottavio Campana
Hello, I'm designing a database and I'm having some problems, so I ask you a suggestion. 1) The database I'm going to develop is a big list with a catalog of items and I want to store subsets of this list representing the available items in several places. My idea is to create the big