Re: [GENERAL] float to int

2007-11-12 Thread Edoardo Panfili
Charles.Hou ha scritto: > how can i get the int value using the sql language? like this, > > "select cost from my_money_table " , the data type of cost is float. > take a look at http://www.postgresql.org/docs/8.2/static/sql-expressions.html CAST ( expression AS type ) expression::type Edoardo

Re: [GENERAL] hibernate + postgresql ?

2007-11-29 Thread Edoardo Panfili
Oleg Bartunov ha scritto: Hello, any exprerience with Hibernate + PostgreSQL ? How does this combination is flexible and smart ? Is't possible to tune selected queries ? You can evaluate also JPA, openJPA (http://openjpa.apache.org/) seems good but now I have only simple query on it. Edoardo

[GENERAL] group by and count(*) behaviour in 8.3

2008-01-02 Thread Edoardo Panfili
I am using this query in 8.3beta4 (compiled from source) in MacOS X 10.5.1 SELECT webName,count(*) FROM contenitore NATURAL JOIN cartellino WHERE contenitore.tipo='e' GROUP BY webName; this is the result webName | count -

Re: [GENERAL] group by and count(*) behaviour in 8.3

2008-01-02 Thread Edoardo Panfili
bug on my import in new database! To avoid future error of this type, how can I ask to postgres wath column is it using in "natural join"? tanks again and sorry for my error Edoardo Regards Pavel Stehule On 02/01/2008, Edoardo Panfili <[EMAIL PROTECTED]> wrote: I am usi

Re: [GENERAL] postgis 1.5.2 installation configure: WARNING: could not locate CUnit required for liblwgeom unit tests

2011-02-07 Thread Edoardo Panfili
On 07/02/11 18.55, Paul Ramsey wrote: Well, maybe you could in-place upgrade if you left your PostGIS version at the original and only upgraded the PostgreSQL part, but you aren't doing that, you're also upgrading your PostGIS version. pg_dump the database create a new database on the new server

Re: [GENERAL] SELECT INTO array[i] with PL/pgSQL

2011-02-07 Thread Edoardo Panfili
On 07/02/11 22.15, Julia Jacobson wrote: Dear PostgreSQL community, Please consider the following minimal example: CREATE TABLE example (row_id SERIAL, value TEXT); INSERT INTO example(value) VALUES ('val1'); INSERT INTO example(value) VALUES ('val2'); INSERT INTO example(value) VALUES ('val3')

Re: [GENERAL] unable to build postgres-9.4 in os x 10.9 with python

2014-05-30 Thread Edoardo Panfili
Il 30/05/14 18:49, reiner peterke ha scritto: Hi, has anyone else had this issue and does any one know the solution? Since upgrading my mac from os x 10.8 to 10.9, i can no long build postgres with '--with-python’. i get the following error. ld: framework not found Python clang: error: linke

[GENERAL] psql connection via localhost or 127.0.0.1

2014-11-06 Thread Edoardo Panfili
I am using postgres 9.4beta3 (Debian jessie) this is my pg_hba.conf -- localallpostgrespeer localallallmd5 hostallall127.0.0.1/32md5 hostallall::1/128md5 -- but if I use psql to connect via tcp to the

Re: [GENERAL] psql connection via localhost or 127.0.0.1

2014-11-06 Thread Edoardo Panfili
Il 06/11/14 16:00, John R Pierce ha scritto: On 11/6/2014 6:34 AM, Edoardo Panfili wrote: Why localhost is not an alias for 127.0.0.1 ? grep localhost /etc/hosts 127.0.0.1 localhost 127.0.1.1 host.host host # The following lines are desirable for IPv6 capable hosts ::1

Re: [GENERAL] psql connection via localhost or 127.0.0.1

2014-11-06 Thread Edoardo Panfili
Il 06/11/14 16:08, Tom Lane ha scritto: Edoardo Panfili writes: I am using postgres 9.4beta3 (Debian jessie) this is my pg_hba.conf -- localallpostgrespeer localallallmd5 hostallall127.0.0.1/32md5 hostallall::1/128md5

Re: [GENERAL] psql connection via localhost or 127.0.0.1

2014-11-06 Thread Edoardo Panfili
Il 06/11/14 16:18, Adrian Klaver ha scritto: On 11/06/2014 07:00 AM, John R Pierce wrote: On 11/6/2014 6:34 AM, Edoardo Panfili wrote: Why localhost is not an alias for 127.0.0.1 ? grep localhost /etc/hosts I've seen some weird stuff on some systems. I have localhost/127.0.0.1 s

Re: [GENERAL] psql connection via localhost or 127.0.0.1

2014-11-06 Thread Edoardo Panfili
Il 06/11/14 16:47, John R Pierce ha scritto: On 11/6/2014 7:36 AM, Edoardo Panfili wrote: grep localhost /etc/hosts 127.0.0.1 localhost 127.0.1.1 host.host host wah? whats the output of ... # ifconfig lo loLink encap:Local Loopback inet addr:127.0.0.1

Re: [GENERAL] psql connection via localhost or 127.0.0.1

2014-11-06 Thread Edoardo Panfili
Il 06/11/14 16:54, Adrian Klaver ha scritto: On 11/06/2014 07:47 AM, John R Pierce wrote: On 11/6/2014 7:36 AM, Edoardo Panfili wrote: grep localhost /etc/hosts 127.0.0.1 localhost 127.0.1.1 host.host host wah? https://lists.debian.org/debian-devel/2013/07/msg00809

[GENERAL] C function and enum types parameters

2008-03-21 Thread Edoardo Panfili
I use a C function in my database from 2002, all goes well also with postgresql 8.3 but with 8.3.1 it no longer works, the problem is with this line: text *hibrid = (PG_ARGISNULL( 0) || VARSIZE(PG_GETARG_TEXT_P( 0))==VARHDRSZ ?NULL:PG_GETARG_TEXT_P(0)); the argument number 0 is an enum defined

Re: [GENERAL] C function and enum types parameters

2008-03-24 Thread Edoardo Panfili
Edoardo Panfili ha scritto: I use a C function in my database from 2002, all goes well also with postgresql 8.3 but with 8.3.1 it no longer works, the problem is with this line: text *hibrid = (PG_ARGISNULL( 0) || VARSIZE(PG_GETARG_TEXT_P( 0))==VARHDRSZ ?NULL:PG_GETARG_TEXT_P(0)); the

[GENERAL] add a value to an ENUM type

2009-09-03 Thread Edoardo Panfili
I have an enum type CREATE TYPE shapeName AS ENUM('rectangle','circle'); now I need another value: 'square' the pg_type.oid of 'shapename is 16458 It works, but Is it safe to use this? insert into pg_enum (enumtypid,enumlabel) VALUES('16458','square'); thank you Edoardo -- Sent via pgsql-gene

Re: [GENERAL] add a value to an ENUM type

2009-09-03 Thread Edoardo Panfili
On 03/09/09 22.13, APseudoUtopia wrote: On Thu, Sep 3, 2009 at 12:52 PM, Edoardo Panfili wrote: I have an enum type CREATE TYPE shapeName AS ENUM('rectangle','circle'); now I need another value: 'square' the pg_type.oid of 'shapename is 16458 It works,

Re: [GENERAL] unique across two tables

2011-06-23 Thread Edoardo Panfili
On 22/06/11 18.30, David Johnston wrote: The only (obvious to me) way to really solve the problem - invisibly - is to allow for table-less unique indexes that multiple tables can share and that have a pointer to the "source" table for any particular entry in the index. The other method being disc

Re: [GENERAL] unique across two tables

2011-06-23 Thread Edoardo Panfili
On 23/06/11 22.39, Tomas Vondra wrote: Dne 23.6.2011 20:39, Edoardo Panfili napsal(a): I Have the same problem: one ID must be unique. Three tables inherits from the same parent table the id column, the ID is is defined as: id bigint DEFAULT nextval('sequence_name') in the parent tab

[GENERAL] A questions on planner choices

2011-08-19 Thread Edoardo Panfili
I apologize for my english and... also for the explanation perhaps not very clear. I have some doubt regarding the planner choice for my query, usually it does a very good job and I would prefer to leave free the planner but with this query I have some doubt: I use tree tables, cartellino with

Re: [GENERAL] A questions on planner choices

2011-08-19 Thread Edoardo Panfili
Il 19/08/11 22:15, Scott Marlowe ha scritto: On Fri, Aug 19, 2011 at 1:05 PM, Edoardo Panfili wrote: [1] Plan for the firts query --- Sort

Re: [GENERAL] A questions on planner choices

2011-08-19 Thread Edoardo Panfili
Il 20/08/11 04:28, Tom Lane ha scritto: Edoardo Panfili writes: [ poor plan for a Postgis query with ] Postgres 8.4.8 with postgis 1.5.3 I think that most of the issue here is poor selectivity estimation for the Postgis operations, particularly&&. I suggest that you should ask about

Re: [GENERAL] How to import *.sql file to postgresql database

2010-07-18 Thread Edoardo Panfili
On 18/07/10 22.06, Andre Lopes wrote: Hi, I have a DUMP file with INSERT's commands. I need to import this data to postgresql database with the "psql" command. How can I do this task? I think psql -U user_name database_name http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Help with select with max and min please

2010-08-08 Thread Edoardo Panfili
On 08/08/10 20.47, Jose Maria Terry wrote: Hello all, I need to run a query on a table that holds logged data from several water flow meters. I need the first and last values (with their associated time) for every logger in a time range. I've tried this that returns the min and max time in the

[GENERAL] foreign keys and inheritance problem

2010-08-12 Thread Edoardo Panfili
hi, I am in some trouble with my tables defined using inheritance, This is a semplified test case: --- create table sub1( name1 text) inherits(father); create table sub2( name2 text) inherits(father); create table other (description text, id integer); -- I know, the contrai

Re: [GENERAL] foreign keys and inheritance problem

2010-08-12 Thread Edoardo Panfili
On 12/08/10 18.59, Edoardo Panfili wrote: hi, I am in some trouble with my tables defined using inheritance, This is a semplified test case: --- create table sub1( name1 text) inherits(father); create table sub2( name2 text) inherits(father); create table other (description

Re: [GENERAL] foreign keys and inheritance problem

2010-08-12 Thread Edoardo Panfili
On 12/08/10 20.44, Tom Lane wrote: Edoardo Panfili writes: On 12/08/10 18.59, Edoardo Panfili wrote: I am in some trouble with my tables defined using inheritance, No, foreign keys do not play very nicely with inheritance. There is some explanation in the manual, in the "Ca

Re: [GENERAL] optimizer ignoring primary key and doing sequence scan

2008-07-14 Thread Edoardo Panfili
Scott Marlowe ha scritto: On Mon, Jul 14, 2008 at 1:54 PM, Chris Hoy <[EMAIL PROTECTED]> wrote: Hi I have a number of tables in my database where the queries appear to ignoring the primary key and doing a seq scan instead, however other tables appear to be fine. I can see any difference between

[GENERAL] immutable functions and enumerate type casts in indexes

2008-09-01 Thread Edoardo Panfili
Hello, I have a problem with enumerated types in functions parameters. my enumerated type is (this is a subset) CREATE TYPE hibridation AS ENUM('none','genus','specie'); function declaration CREATE FUNCTION ename(text,boolean,text,text RETURNS text AS 'funzioniGDB.so' LANGUAGE C IMMUTABLE; i

Re: [GENERAL] immutable functions and enumerate type casts in indexes

2008-09-02 Thread Edoardo Panfili
Tom Lane ha scritto: Edoardo Panfili <[EMAIL PROTECTED]> writes: my enumerated type is (this is a subset) CREATE TYPE hibridation AS ENUM('none','genus','specie'); function declaration CREATE FUNCTION ename(text,boolean,text,text RETURNS text AS &

Re: [GENERAL] immutable functions and enumerate type casts in indexes

2008-09-03 Thread Edoardo Panfili
Martijn van Oosterhout ha scritto: On Tue, Sep 02, 2008 at 10:53:03AM +0200, Edoardo Panfili wrote: But i have a little question about parameters of enum_out. Datum enum_out(PG_FUNCTION_ARGS); this is a part of my function --- Datum

Re: [GENERAL] immutable functions and enumerate type casts in indexes

2008-09-03 Thread Edoardo Panfili
Tom Lane ha scritto: Edoardo Panfili <[EMAIL PROTECTED]> writes: labelDatum = DirectFunctionCall1(enum_out,datumIbrido); label = (char *) DatumGetPointer(labelDatum); Just FYI, preferred style for the second line would be label = DatumGetCString(labelDatum);

Re: [GENERAL] Textmatchning

2008-09-17 Thread Edoardo Panfili
A B ha scritto: Hi. I would like to compare two columns a and b and find all cases where a is a part of b, like this select * from mytable where a ilike b; but that will not give me a row in the case when a = 'foo' and b='FOOTBALL' and I want that to be a match. So how do I rewrite my express

Re: [GENERAL] PostGIS in a commercial project

2011-10-24 Thread Edoardo Panfili
Il 24/10/11 10:03, Pavel Stehule ha scritto: 2011/10/24 Thomas Kellerer: Eduardo Morras, 21.10.2011 20:53: Now PostGIS is licensed under the GPL and I wonder if we can use it in a commercial (customer specific) project then. The source code will not be made open source, but of course the custo

Re: [GENERAL] PostGIS in a commercial project

2011-10-24 Thread Edoardo Panfili
Il 24/10/11 12:19, Pavel Stehule ha scritto: 2011/10/24 Edoardo Panfili: Il 24/10/11 10:03, Pavel Stehule ha scritto: 2011/10/24 Thomas Kellerer: Eduardo Morras, 21.10.2011 20:53: Now PostGIS is licensed under the GPL and I wonder if we can use it in a commercial (customer specific

Re: [GENERAL] Is it even possible?

2012-03-20 Thread Edoardo Panfili
Il 20/03/12 15:22, Sam Loy ha scritto: I have now tried at least 7 different install methods to get pg up and running on Lion. I fear that my system is now thoroughly inoculated and will never be able to run postgres/postgis. I started with the pg mac installer / stack builder. That worked to

[GENERAL] can't figure string compare result (using also custom C function)

2009-02-13 Thread Edoardo Panfili
I have this query: (1 result) SELECT idSpecie,nome FROM specienomi WHERE idspecie=37026 and nome='X Agropogon littoralis (Sm.) C.E. Hubb.'; idspecie | nome --+- 37026 | X Agropogon littoralis (Sm.) C.E. Hubb. The same query

Re: [GENERAL] can't figure string compare result (using also custom C function)

2009-02-13 Thread Edoardo Panfili
Sam Mason ha scritto: On Fri, Feb 13, 2009 at 10:31:49PM +0100, Edoardo Panfili wrote: The problem arises only with particular records, when the first character of the string is generated by my function [1]. When the first character is copied from postgres parameter [2] all works fine. [1

Re: [GENERAL] can't figure string compare result (using also custom C function)

2009-02-14 Thread Edoardo Panfili
Sam Mason ha scritto: On Fri, Feb 13, 2009 at 10:31:49PM +0100, Edoardo Panfili wrote: SELECT idSpecie,nome FROM specienomi WHERE idspecie=37026 and nome='X Agropogon littoralis (Sm.) C.E. Hubb.'; idspecie | nome --+-

Re: [GENERAL] ORDER BY: lexicographic ordering of names

2009-03-18 Thread Edoardo Panfili
Il 18-03-2009 21:32, Bryan Herger ha scritto: All, I am porting a database from MS SQL Server to Postgres. One of the tables contains a list of names, which I would like to list alphabetically. I noticed in the “O” names the following difference: MSSQL: O’Daniel O’Neill Oliveira Oliver While P

[GENERAL] strange (maybe) behaviour of table lock

2006-12-08 Thread Edoardo Panfili
;LOCK table,table2,table3,table4 IN EXCLUSIVE MODE" and no other modifications. I stop and restart my system, all works well. Can someone tell me if this is a desidered behaviour? (and if is possible why). If may help I can post all the queryes and table structure, they are a little long

Re: [GENERAL] strange (maybe) behaviour of table lock

2006-12-08 Thread Edoardo Panfili
Tom Lane wrote: Edoardo Panfili <[EMAIL PROTECTED]> writes: I have a servlet that uses connection pools. The servlet do "LOCK table,table2,table3,table4" then do some select (I am testing the code, I will put the update in the future) an then I close instruction and connecti

Re: [GENERAL] strange (maybe) behaviour of table lock

2006-12-08 Thread Edoardo Panfili
Tom Lane wrote: Edoardo Panfili <[EMAIL PROTECTED]> writes: It seems that if I put some delay between calls to the servlet all goes well. I can change lock level but ther is something wrong. Obviously I am doiung something wrong. To unlock the tables is not sufficient close the Stateme

Re: [GENERAL] strange (maybe) behaviour of table lock

2006-12-08 Thread Edoardo Panfili
Scott Marlowe wrote: On Fri, 2006-12-08 at 09:16, Edoardo Panfili wrote: I have a question regarding a strange behaviour (for me, maybe that this is desidered feature) of LOCK on tables. I am using postgres 8.2 I have a servlet that uses connection pools. The servlet do "LOCK table,t

Re: [GENERAL] strange (maybe) behaviour of table lock

2006-12-08 Thread Edoardo Panfili
Tom Lane wrote: Edoardo Panfili <[EMAIL PROTECTED]> writes: I spend many time to explain the bahaviour of the system: I some occasions the system use another connection to retrieve some information during the main connection. This explain the hangs but... why sometimes the system

Re: [GENERAL] Codifica database

2007-03-29 Thread Edoardo Panfili
andant wrote: Ciao a tutti.. Devo inserire in un campo u testo, prelevato input. Il problema e che in questo testo possono essere inseriti i seeguenti caratteri: è ò à ù ì € $ £ ( ) Al momento sto usando come codifica del Database: UTF8. non me li fa inserire... Qualc'uno mi potrebbe consi