[GENERAL] naked objects from stored procedures, interface generation

2010-12-23 Thread Wim Bertels

Hallo,

there exist many framework that 'backward' engineer from a programming 
language to database to make the data persistent.

so: code >> db (generated)
eg. hibernate, turbogears many others

My question is, from db point of view, do we have such frameworks that 
work the other way,
ie that forward engineer from a database to a user interface (web or 
program),
maybe using the stored procedures available on the database (eg in the 
same naked objects work)
so: exisiting db (possible + stored procedures) >> user interface (eg 
crud or other)


mvg,
Wim

--
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] naked objects from stored procedures, interface generation

2010-12-23 Thread Pavel Stehule
Hello

I know about one similar project - Garuda, but this project isn't open.

What it does:

* OOP - objects, properties, methods - not based on PostgreSQL OOP
* support of workflow - lifecycle for objects
* support of collection of objects

It was designed in plpgsql with special modules to PHP, where was
possible to work with Garuda objects like PHP objects.

Regards

Pavel Stehule


2010/12/23 Wim Bertels :
> Hallo,
>
> there exist many framework that 'backward' engineer from a programming
> language to database to make the data persistent.
> so: code >> db (generated)
> eg. hibernate, turbogears many others
>
> My question is, from db point of view, do we have such frameworks that work
> the other way,
> ie that forward engineer from a database to a user interface (web or
> program),
> maybe using the stored procedures available on the database (eg in the same
> naked objects work)
> so: exisiting db (possible + stored procedures) >> user interface (eg crud
> or other)
>
> mvg,
> Wim
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

-- 
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] naked objects from stored procedures, interface generation

2010-12-23 Thread John R Pierce

On 12/23/10 12:19 AM, Wim Bertels wrote:
My question is, from db point of view, do we have such frameworks that 
work the other way,
ie that forward engineer from a database to a user interface (web or 
program),
maybe using the stored procedures available on the database (eg in the 
same naked objects work)
so: exisiting db (possible + stored procedures) >> user interface (eg 
crud or other)


one database can serve many applications.

the database provides the persistent storage for the 'model' part of a 
classic M-V-C system, and it can provide some to much of the 'model' 
business logic, but its really not suitable for either the view or the 
controller, those are better expressed in other domains




--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Need Help in query

2010-12-23 Thread Satish Burnwal (sburnwal)
I need a help in writing a query. I have data as follows:

mydb=# select * from usrlog ;
 logid |  userid  | loginhr | logouthr 
---+--+-+--
 0 | sburnwal |   0 |1
 1 | rickyrs   |   1 |5
 2 | satishbn |   1 |6
 3 | taohujin |   2 |4
 4 | jospehm |   4 |5


Table captures the login and logout time (taking hour here to simplify)
of users and my aim to find the number of logged-in users (online users)
at every hr (1st hr i.e. 0-1, 2nd hrs i.e. 1-2, 3rd hr i.e. 2-3 and ...
so on). As the data indicates, use is not logging out in same hr as hr
of login. A user can be logged-in for more than one hr. For example,
here user rickyrs is logged-in for 1st, 2nd, 3rd, 4th  and 5th hr. My
query needs to find out in the last 24 hrs, how many users were
logged-in at each hr. I want the result this way:

Nth-hr   user
---
1   sburnwal
2   rickyrs
2   satishbn
3   rickyrs
3   satishbn
3   taohujin
4   rickyrs
4   satishbn
4   taohujin
4   josephm

Appreciate your response in advance. For me, even the count of users on
hourly basis is fine.

Thanks
-Satish

-- 
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] Need Help in query

2010-12-23 Thread Nicklas Avén
Hallo

This I think should work.

To get the usernames by hour as you describe:

SELECT h.hour, usrlog.userid
(select generate_series(1,24) as hour) as h
inner join
usrlog
on h.hour >= usrlog.loginhr and h.hour <= usrlog.logouthr
order by h.hour, usrlog.userid;

To get the number of users per hour :

Select h.hour, count(*) asNumberOfUsers
(select generate_series(1,24) as hour) h
inner join
usrlog
on h.hour >= usrlog.loginhr and h.hour <= usrlog.logouthr
group by h.hour;

HTH

Nicklas



2010-12-23 skrev Satish Burnwal (sburnwal) :

I need a help in writing a query. I have data as follows:
>
>mydb=# select * from usrlog ;
> logid |  userid  | loginhr | logouthr 
>---+--+-+--
> 0 | sburnwal |   0 |1
> 1 | rickyrs   |   1 |5
> 2 | satishbn |   1 |6
> 3 | taohujin |   2 |4
> 4 | jospehm |   4 |5
>
>
>Table captures the login and logout time (taking hour here to simplify)
>of users and my aim to find the number of logged-in users (online users)
>at every hr (1st hr i.e. 0-1, 2nd hrs i.e. 1-2, 3rd hr i.e. 2-3 and ...
>so on). As the data indicates, use is not logging out in same hr as hr
>of login. A user can be logged-in for more than one hr. For example,
>here user rickyrs is logged-in for 1st, 2nd, 3rd, 4th  and 5th hr. My
>query needs to find out in the last 24 hrs, how many users were
>logged-in at each hr. I want the result this way:
>
>Nth-hr   user
>---
>1  sburnwal
>2  rickyrs
>2  satishbn
>3  rickyrs
>3  satishbn
>3  taohujin
>4  rickyrs
>4  satishbn
>4  taohujin
>4  josephm
>
>Appreciate your response in advance. For me, even the count of users on
>hourly basis is fine.
>
>Thanks
>-Satish
>
>-- 
>Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
>To make changes to your subscription:
>http://www.postgresql.org/mailpref/pgsql-general
>
>

[GENERAL] Issue while using PostgreSql 8.4.

2010-12-23 Thread Atul Kumar
Hi,
I am using PostgreSql  8.4 for my web application also  am 
using following technology stacks:

1> Java

2> Window XP (OS).

3> JBoss Server4.2.
My issue is, first time I am creating the table and inserting some rows of 
data. After doing some logic going to delete that table . I am observing 
application is getting hang while executing statement.execute().

Please suggest me how to fix this issue.

Thanks
Atul Kumar

DISCLAIMER
==
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.


Re: [GENERAL] Need Help in query

2010-12-23 Thread Satish Burnwal (sburnwal)
Thanks! I did not know such a function exists.

 

From: Nicklas Avén [mailto:nicklas.a...@jordogskog.no] 
Sent: Thursday, December 23, 2010 3:31 PM
To: Satish Burnwal (sburnwal)
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Need Help in query

 

Hallo

This I think should work.

To get the usernames by hour as you describe:

SELECT h.hour, usrlog.userid
(select generate_series(1,24) as hour) as h
inner join
usrlog
on h.hour >= usrlog.loginhr and h.hour <= usrlog.logouthr
order by h.hour, usrlog.userid;

To get the number of users per hour :

Select h.hour, count(*) asNumberOfUsers
(select generate_series(1,24) as hour) h
inner join
usrlog
on h.hour >= usrlog.loginhr and h.hour <= usrlog.logouthr
group by h.hour;

HTH

Nicklas



2010-12-23 skrev Satish Burnwal (sburnwal) :

I need a help in writing a query. I have data as follows:
>
>mydb=# select * from usrlog ;
> logid | userid | loginhr | logouthr 
>---+--+-+--
> 0 | sburnwal | 0 | 1
> 1 | rickyrs | 1 | 5
> 2 | satishbn | 1 | 6
> 3 | taohujin | 2 | 4
> 4 | jospehm | 4 | 5
>
>
>Table captures the login and logout time (taking hour here to simplify)
>of users and my aim to find the number of logged-in users (online users)
>at every hr (1st hr i.e. 0-1, 2nd hrs i.e. 1-2, 3rd hr i.e. 2-3 and ...
>so on). As the data indicates, use is not logging out in same hr as hr
>of login. A user can be logged-in for more than one hr. For example,
>here user rickyrs is logged-in for 1st, 2nd, 3rd, 4th and 5th hr. My
>query needs to find out in the last 24 hrs, how many users were
>logged-in at each hr. I want the result this way:
>
>Nth-hr user
>---
>1 sburnwal
>2 rickyrs
>2 satishbn
>3 rickyrs
>3 satishbn
>3 taohujin
>4 rickyrs
>4 satishbn
>4 taohujin
>4 josephm
>
>Appreciate your response in advance. For me, even the count of users on
>hourly basis is fine.
>
>Thanks
>-Satish
>
>-- 
>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] copy from problem

2010-12-23 Thread Mark Watson
Le 22/12/2010 21:34, Mark Watson a écrit :
> Hello all,
> (Postgres 8.4.6 Windows)
> I am stumped as to why I cannot import this using copy from within pgadmin
> (the following table is created in an existing database with an encoding
of
> WIN1252 and the Postgres server_encoding is UTF8) :
> CREATE TABLE test
> (
>   col_descr text
> )
> WITH (
>   OIDS=FALSE
> );
> ALTER TABLE test OWNER TO postgres;
> set client_encoding = 'WIN1252';
> COPY test FROM 'C:\\pgtemp\\test.txt' with  delimiter as '|' csv;
> select * from test;
> --- col_descr
> -- 
> -- (empty row)
>
> The file test.txt contains 1 line of 2 characters: éÉ  (acute accented
> lowercase and uppercase e, hex(E9C9), valid win1252 characters.
>
> Any help would be appreciated.

It would be so much easier if you told us your error message.


--
Guillaume
 http://www.postgresql.fr
 http://dalibo.com


Another update :
After toying around with this, I think this is a subject for the PgAdmin
list. It looks like a display problem in pgAdmin. The characters are being
displayed with a client_encoding of UTF8 but not with a client_encoding of
WIN1252. My application, which sets client_encoding to WIN1252, receives and
displays the characters correctly. By the way, my pgAdmin is configured with
Preferences=>Font = Tahoma windows-1252 and Query=>Font = Tahoma 9
windows-1252.



-- 
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] copy from problem

2010-12-23 Thread Guillaume Lelarge
Le 23/12/2010 14:36, Mark Watson a écrit :
> Le 22/12/2010 21:34, Mark Watson a écrit :
>> Hello all,
>> (Postgres 8.4.6 Windows)
>> I am stumped as to why I cannot import this using copy from within pgadmin
>> (the following table is created in an existing database with an encoding
> of
>> WIN1252 and the Postgres server_encoding is UTF8) :
>> CREATE TABLE test
>> (
>>col_descr text
>> )
>> WITH (
>>OIDS=FALSE
>> );
>> ALTER TABLE test OWNER TO postgres;
>> set client_encoding = 'WIN1252';
>> COPY test FROM 'C:\\pgtemp\\test.txt' with  delimiter as '|' csv;
>> select * from test;
>> --- col_descr
>> -- 
>> -- (empty row)
>>
>> The file test.txt contains 1 line of 2 characters: éÉ  (acute accented
>> lowercase and uppercase e, hex(E9C9), valid win1252 characters.
>>
>> Any help would be appreciated.
> 
> It would be so much easier if you told us your error message.
> 
> 
> --
> Guillaume
>  http://www.postgresql.fr
>  http://dalibo.com
> 
> 
> Another update :
> After toying around with this, I think this is a subject for the PgAdmin
> list. It looks like a display problem in pgAdmin. The characters are being
> displayed with a client_encoding of UTF8 but not with a client_encoding of
> WIN1252. My application, which sets client_encoding to WIN1252, receives and
> displays the characters correctly. By the way, my pgAdmin is configured with
> Preferences=>Font = Tahoma windows-1252 and Query=>Font = Tahoma 9
> windows-1252.
> 

pgAdmin sets the client encoding to UTF-8 and only displays UTF-8.


-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.com

-- 
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] copy from problem

2010-12-23 Thread Mark Watson
Le 23/12/2010 14:36, Mark Watson a écrit :
> Le 22/12/2010 21:34, Mark Watson a écrit :
>> Hello all,
>> (Postgres 8.4.6 Windows)
>> I am stumped as to why I cannot import this using copy from within
pgadmin
>> (the following table is created in an existing database with an encoding
> of
>> WIN1252 and the Postgres server_encoding is UTF8) :
>> CREATE TABLE test
>> (
>>    col_descr text
>> )
>> WITH (
>>    OIDS=FALSE
>> );
>> ALTER TABLE test OWNER TO postgres;
>> set client_encoding = 'WIN1252';
>> COPY test FROM 'C:\\pgtemp\\test.txt' with  delimiter as '|' csv;
>> select * from test;
>> --- col_descr
>> -- 
>> -- (empty row)
>>
>> The file test.txt contains 1 line of 2 characters: éÉ  (acute accented
>> lowercase and uppercase e, hex(E9C9), valid win1252 characters.
>>
>> Any help would be appreciated.
>
> It would be so much easier if you told us your error message.
>
>
> --
> Guillaume
>  http://www.postgresql.fr
>  http://dalibo.com
>
> 
> Another update :
> After toying around with this, I think this is a subject for the PgAdmin
> list. It looks like a display problem in pgAdmin. The characters are being
> displayed with a client_encoding of UTF8 but not with a client_encoding of
> WIN1252. My application, which sets client_encoding to WIN1252, receives
and
> displays the characters correctly. By the way, my pgAdmin is configured
with
> Preferences=>Font = Tahoma windows-1252 and Query=>Font = Tahoma 9
> windows-1252.
>

pgAdmin sets the client encoding to UTF-8 and only displays UTF-8.


--
Guillaume
 http://www.postgresql.fr
 http://dalibo.com 

Thanks, Guillaume! That answers everything. Happy holidays to all!
-Mark


-- 
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] [BUGS] Issue while using PostgreSql 8.4.

2010-12-23 Thread Kevin Grittner
Atul Kumar  wrote:
 
> My issue is, first time I am creating the table and inserting some
> rows of data. After doing some logic going to delete that table .
> I am observing application is getting hang while executing
> statement.execute().
 
It's taking a long time to run which statement, a DELETE of all rows
in a table?
 
This isn't sounding much like a PostgreSQL bug at this point, but
with so little information, it is hard to tell for sure.  Please
review this page:
 
http://wiki.postgresql.org/wiki/Guide_to_reporting_problems
 
As a "shot in the dark" -- if the statement which is taking a long
time is the DELETE, and you want to delete all rows in the table,
try TRUNCATE TABLE.
 
-Kevin

-- 
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] Issue while using PostgreSql 8.4.

2010-12-23 Thread Harald Armin Massa
Atul,


My issue is, first time I am creating the table and inserting some rows of
> data. After doing some logic going to delete that table . I am observing
> application is getting hang while executing statement.execute().
>
>
>
> Please suggest me how to fix this issue.
>
>
>
I am assuming your  statement.execute includes something like

"drop table "

did you make ABSOLUTELY sure that no part of your (or any other running)
programm is still "interested" in that table?

as in "maybe some ORM-mapper still has a transaction open into that table"?

Because dropping a locked table has to wait until the lock is gone to
complete. (esp. if there is an implicit commit in your execute; which may or
may not be, depending on your connection-configuration)

Harald


-- 
Harald Armin Massa www.2ndQuadrant.com
PostgreSQL  Training, Services  and Support


[GENERAL] FW: Issue while using PostgreSql 8.4.

2010-12-23 Thread Atul Kumar

Hi,
I am using PostgreSql  8.4 for my web application also  am 
using following technology stacks:

1> Java

2> Window XP (OS).

3> JBoss Server4.2.
My issue is, first time I am creating the table and inserting some rows of 
data. After doing some logic going to delete that table . I am observing 
application is getting hang while executing statement.execute().

Please suggest me how to fix this issue.

Thanks
Atul Kumar

DISCLAIMER
==
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.


[GENERAL] Issue while using PostgreSql 8.4.

2010-12-23 Thread Atul Kumar
Hi,
I am using PostgreSql  8.4 for my web application also  am 
using following technology stacks:

1> Java

2> Window XP (OS).

3> JBoss Server4.2.
My issue is, first time I am creating the table and inserting some rows of 
data. After doing some logic going to delete that table . I am observing 
application is getting hang while executing statement.execute().

Please suggest me how to fix this issue.

Thanks
Atul Kumar

DISCLAIMER
==
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.


[GENERAL] Data backup to local duplicate without resetting permissions

2010-12-23 Thread gvim

What's the easiest way, in PostgreSQL 9.0, to keep a duplicate database on my 
local machine updated at intervals from another on a remote machine without 
having to reset permissions after a backup/restore. Also which type of backup? 
Plain text or compressed? Data-only or complete shema? Setup duplicate users or 
can I use a distinct set of users? I would ideally like to have the same 
schemas setup with distinct users then simply have a data-only backup from the 
remote server which I can restore to the local machine without resetting 
privileges/permissions.

gvim

--
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] "could not accept SSPI security context"

2010-12-23 Thread Reto Schöning
thanks a lot for the hints.

All connections I tried used the IP address of the pg server. Also the
service name should be the default one.

I tried setting the sspitarget in SSPIHandler.cs to all sorts of variations,
including fully qualified names. The error remains exactly the same, even
when I set sspitarget to nonsensical values.
I'll discuss this with our IT in january. Maybe there IS some inconsistency
in those AD accounts, only that the authentication from libpq can cope with
that. From afar it seems that the calls to AcquireCredentialsHandle() and
InitializeSecurityContext() in npgsql and libpq do the same thing though.

Regards, Reto

2010/12/22 Brar Piening 

>   Original Message  
> Subject: Re: [GENERAL] "could not accept SSPI security context"
> From: Reto Schöning  
> To: Brar Piening  
> Date: 22.12.2010 17:08
>
>
> "The security database on the server does not have a computer account for
> this workstation trust relationship"
>
> [...]
>
> Is there anything else in the code that I could check or try?
>
>
> Did you make sure that all connection parameters are the same between libpq
> clients (psql, PgAdmin, ...) and Npgsql?
>
> Also on my computer PgAdmin fails to connect if I try to connect to
> "localhost" instead of "127.0.0.1" via SSPI while connecting (some test app)
> via Npgsql will work (by internally using the ip addresses in
> Socket.RemoteEndPoint.Address instead of the host name).
> This could lead to the fact that a Npgsql program uses a different Kerberos
> service principal than you might think as it uses the first working ip
> address from Dns.GetHostAddresses as hostname part.
> What bothers me about this is that if
> http://www.postgresql.org/docs/current/static/auth-methods.html#KERBEROS-AUTHis
>  correct by stating that "The name of the service principal is
> *servicename*/*hostna...@*realm*. " and "*hostname* is the fully qualified
> host name of the server machine." connecting via host name should work in
> principle while it doesn't on my machine (actually using NTLM).
>
> One other thing that comes to mind is the fact that Npgsql is currently
> hardcoded to use "POSTGRES" as Kerberos service name while in libpq this can
> be changed as a compile time option, a server configuration parameter and a
> connection parameter setting.
> Still this is an unlikely cause if you didn't fiddle around with this in
> psql as the PostgreSQL docs state: " In most environments, this parameter
> never needs to be changed. However, it is necessary when supporting multiple
> PostgreSQL installations on the same host. Some Kerberos implementations
> might also require a different service name, such as Microsoft Active
> Directory which requires the service name to be in upper case (POSTGRES).
> "
>
> Sorry for those pretty random amateurish guesses but I've got zero Kerberos
> experience and not even a kerberos setup to test with.
>
> Best Regards,
>
> Brar
>


[GENERAL] How to calculate length of path data without diagonals?

2010-12-23 Thread Romain Billoir
Hi, i need to calculate some length of path without diagonal. Some examples:
length((5,5),(6,6))) returns 1.41. I need 2: 5,5 to 5,6 + 5,6 to 6,6.

Is that possible?


Re: [GENERAL] How to calculate length of path data without diagonals?

2010-12-23 Thread John R Pierce

On 12/23/10 10:25 AM, Romain Billoir wrote:
Hi, i need to calculate some length of path without diagonal. Some 
examples:

length((5,5),(6,6))) returns 1.41. I need 2: 5,5 to 5,6 + 5,6 to 6,6.

Is that possible?


a path of just two points?   something like   abs(x1-x2) + abs(y1-y2).

--
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] Data backup to local duplicate without resetting permissions

2010-12-23 Thread Adrian Klaver

On 12/23/2010 08:55 AM, gvim wrote:

What's the easiest way, in PostgreSQL 9.0, to keep a duplicate database
on my local machine updated at intervals from another on a remote
machine without having to reset permissions after a backup/restore. Also
which type of backup? Plain text or compressed? Data-only or complete
shema? Setup duplicate users or can I use a distinct set of users? I
would ideally like to have the same schemas setup with distinct users
then simply have a data-only backup from the remote server which I can
restore to the local machine without resetting privileges/permissions.

gvim



This is probably is going to need more information but in the meantime.

pg_dump switches -a data only -O no-owner(do not restore object 
ownership) -x no-privileges(do not dump GRANT/REVOKE commands)


I am not sure what you mean by update on the local machine. If you mean 
start from scratch when you run restore then the above switches will 
help. If you mean only restore differences between the local and remote 
machines then you will need to go down a different path


--
Adrian Klaver
adrian.kla...@gmail.com

--
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] How to calculate length of path data without diagonals?

2010-12-23 Thread Stephen Cook

On 12/23/2010 1:25 PM, Romain Billoir wrote:
> Hi, i need to calculate some length of path without diagonal. Some 
examples:

> length((5,5),(6,6))) returns 1.41. I need 2: 5,5 to 5,6 + 5,6 to 6,6.
>
> Is that possible?


You could write a function to get the Manhattan distance between two 
points, it is the sum of the absolute values of subtracting each part of 
the coordinate. e.g. ABS(x2 - x1) + ABS(y2 - y1)



-- Stephen

--
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] Understanding Schema's

2010-12-23 Thread Jasen Betts
On 2010-12-15, Carlos Mennens  wrote:
> On Tue, Dec 14, 2010 at 7:17 PM, Joshua D. Drake  
> wrote:
>> You can cross query a schema but not a database.
>>
>> So you can create:
>>
>> create table fire.foo()
>> create table ice.foo()
>>
>> And they are isolated from each other physically and logically but you
>> can query them both:
>>
>> SELECT fire.*, ice.* join on (id)
>
> Why would anyone in a random scenario want to have independent
> schema's to cross query? I'm just trying to see how this would be
> useful in any scenario.

Suppose you're an ISP and want to run a mailserver using your user
database for athentications and dbmail for storage and also run  
and a RADIUS server to authenticate your users.  You can put your user 
list in one schema and put the freeradius tables in another but
substitute the freeradius user list with a view which references the 
main userlist, then put dbmail in a third  with another view pointing
back to your userlist Your billing software could be in yet another schema.
etc...


Or perhaps you have a partitioned logging table that changes frequently
and you want to exclude it from backups,  if you put it in a separate
schema it can be easily excluded, else you'd have to liste the approx 100
partition tables for exclusion each time...





-- 
⚂⚃ 100% natural

-- 
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] Understanding Schema's

2010-12-23 Thread Jasen Betts
On 2010-12-15, Craig Ringer  wrote:
> On 12/15/2010 08:08 AM, Carlos Mennens wrote:
>> I've recently switched from MySQL&  have read the documentation for
>> 'schema's' however I guess I'm just not at that level or really daft
>> when it comes to database design.
>
> In terms of the way they work and their operation, PostgreSQL "schemas" 
> are in many ways much more like MySQL "databases" than PostgreSQL 
> "databases" are. Schema separate objects (functions, tables, views, 
> types, etc) into namespaces, but can refer to each other if permissions 
> allow. You can GRANT and REVOKE access to schema the same way you can 
> MySQL databases. You can "change" schema using "SET search_path" in much 
> the same way you'd "USE" a database in MySQL.
>
> PostgreSQL also has "databases" which are largely isolated from each 
> other. They cannot refer to objects in other databases, and a backend 
> connected to one database cannot switch to another one. You cannot "USE" 
> or otherwise change databases on a backend; the psql "\c" command that 
> appears to do this really disconnects and reconnects to a new database.

> It'd be nice if PostgreSQL offered more convenient ways to set an 
> initial schema for new connections, because for some use cases it'd be 
> quite handy to use a single database with many schema. 

the first schema on the search path is the one that matches the name
of the database user. (although you can override this behaviour using 
alter user or alter database - basically any option you can set 
temporarily using "set ... " you can set permanently using "alter user
... set ..." )

eg: alter user jasen set search_path to thatschema;
 
> Unfortunately most tools only know how to ask for a database name

they also ask for a user name, in most cases having the different
services connect using different roles is not a bad thing.

-- 
⚂⚃ 100% natural

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Stitch Large Panorama

2010-12-23 Thread Alfred
Hi, there,

First of all, happy holidays to every one! I wish all of you the best in the 
coming 2011. 

I recently released a large panorama on Gigapan at 
http://www.gigapan.org/gigapans/66626/ . This panorama received many serious 
debate about the true pixel count. Since I used Autopano, my argument was, when 
there is no standard way to calculate the total pixel count, we should not 
manipulate the software output, rather, everyone use the same baseline. Then 
everyone should also provide theoretical estimation of the optical pixel count. 
In this case, 112G pixels. 

The questions here are:

1.  Is there a way to stitch super size panorama in PTGUI?  Can we emit raw 
files so that it is not subjected to image format limit?
2.  Is there a way to import Autopano config file and process in PTGUI?
3.  Can PTGUI accurately report the optical pixel count for super size 
panorama?

Thanks!

Cheers,
Alfred


-- 
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] When the trigger is called my application is awaiting the finish

2010-12-23 Thread Jasen Betts
On 2010-12-16, fel...@informidia.com.br  wrote:
> This is a multi-part message in MIME format.
> --080402070005010104020405
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> Content-Transfer-Encoding: quoted-printable
>
> Hello,
> I'm having a problem running an update command that invokes a trigger,=20
> the problem is that the function performed takes about 45 minutes to=20
> finish and my application is locked waiting for the finish.
> You know how I can't wait for the end?

If you don't care if the update succeeds or not, just don't do the update.
if you do care you need to wait. 

Perhaps there's a way yo make the trigger faster.

-- 
⚂⚃ 100% natural

-- 
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] Data backup to local duplicate without resetting permissions

2010-12-23 Thread Jasen Betts
On 2010-12-23, gvim  wrote:
> What's the easiest way, in PostgreSQL 9.0, to keep a duplicate
> database on my local machine updated at intervals from another on a
> remote machine without having to reset permissions after a
> backup/restore.

create roles matching the names of the remote roles and grant those
roles to your local users.

-- 
⚂⚃ 100% natural

-- 
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] How to calculate length of path data without diagonals?

2010-12-23 Thread Jasen Betts
On 2010-12-23, Romain Billoir  wrote:
> --0015175ccf48e6186a049817fc59
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi, i need to calculate some length of path without diagonal. Some examples:
> length((5,5),(6,6))) returns 1.41. I need 2: 5,5 to 5,6 + 5,6 to 6,6.
>
> Is that possible?

It's called "Manhattan distance" look it up, the arithmentic is easy.

-- 
⚂⚃ 100% natural

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general