[GENERAL] Java Postgres drivers.

2009-12-28 Thread Dave Coventry
I'm not sure this is the right place to enquire...

I'm trying to connect to a postgres datanbase with Java.

import java.sql.*;

public static void main(String[] args) {
// TODO code application logic here
try{
System.out.println("Starting...");
Class.forName("org.postgresql.Driver");
String url="jdbc:postgresql:inenergy";
System.out.println("Got here...");

catch(Exception e){
System.out.println("Error..."+e.getMessage());

}
}

Just don't get to the 'Got here...' statement.

Can anyone see what I'm doing wrong?

-- 
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] Java Postgres drivers.

2009-12-28 Thread John R Pierce

Dave Coventry wrote:

I'm not sure this is the right place to enquire...

I'm trying to connect to a postgres datanbase with Java.
  


does that sample code hang?  do you get an error?

--
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] Why grantor is owner in this case?

2009-12-28 Thread Alvaro Herrera
donniehan wrote:
> Dear Tom,
> 
> I'm sorry to bother you. i really care about this behavior, but i couldn't 
> find the discussions you mentioned in pgsql-hackers archives.
> Would you please tell me more about the discussions(about date? the related 
> issue?), so that i can search it and find it more easily? 

Maybe he's referring to this discussion:
http://archives.postgresql.org/message-id/1176775180.4152.97.camel%40dogma.v10.wvs

Note that on archives.pg.org it is truncated and continues here:
http://archives.postgresql.org/message-id/20070503225044.gk4...@alvh.no-ip.org

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

-- 
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] Java Postgres drivers.

2009-12-28 Thread fernando
Dave,

It looks like the postgresql.jar archive is not in your CLASSPATH.


[]s, Fernando Lozano

> I'm not sure this is the right place to enquire...
> 
> I'm trying to connect to a postgres datanbase with Java.
> 
> import java.sql.*;
> 
> public static void main(String[] args) {
> // TODO code application logic here
> try{
> System.out.println("Starting...");
> Class.forName("org.postgresql.Driver");
> String url="jdbc:postgresql:inenergy";
> System.out.println("Got here...");
> 
> catch(Exception e){
> System.out.println("Error..."+e.getMessage());
> 
> }
> }
> 
> Just don't get to the 'Got here...' statement.
> 
> Can anyone see what I'm doing wrong?
> 
> -- 
> 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] Java Postgres drivers.

2009-12-28 Thread Ivano Luberti
Sure the url looks bad.
Shoudl be something like:

http://jdbc.postgresql.org/dbname


Anyway you cen find more help about jdbc connectivity to postgres here:

http://jdbc.postgresql.org/

Dave Coventry ha scritto:
> I'm not sure this is the right place to enquire...
>
> I'm trying to connect to a postgres datanbase with Java.
>
> import java.sql.*;
>
> public static void main(String[] args) {
> // TODO code application logic here
> try{
> System.out.println("Starting...");
> Class.forName("org.postgresql.Driver");
> String url="jdbc:postgresql:inenergy";
> System.out.println("Got here...");
>
> catch(Exception e){
> System.out.println("Error..."+e.getMessage());
>
> }
> }
>
> Just don't get to the 'Got here...' statement.
>
> Can anyone see what I'm doing wrong?
>
>   

-- 
==
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.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] Why grantor is owner in this case?

2009-12-28 Thread Tom Lane
Alvaro Herrera  writes:
> donniehan wrote:
>> I'm sorry to bother you. i really care about this behavior, but i couldn't 
>> find the discussions you mentioned in pgsql-hackers archives.
>> Would you please tell me more about the discussions(about date? the related 
>> issue?), so that i can search it and find it more easily? 

> Maybe he's referring to this discussion:
> http://archives.postgresql.org/message-id/1176775180.4152.97.camel%40dogma.v10.wvs

No, it's a lot older than that.  See
http://archives.postgresql.org/pgsql-hackers/2003-10/msg01497.php
http://archives.postgresql.org/pgsql-committers/2003-10/msg00305.php

The original 7.4-devel behavior made it effectively impossible for a
superuser to *revoke* privileges, which is certainly not acceptable in
practice.

Looking at the CVS history of aclchk.c, I notice that we later installed
a similar provision with respect to roles: grants/revokes are done as
the role that owns the object, not as the role member that is actually
issuing the command.  Otherwise other role members can't adjust the
privileges.

This comes down to the fact that privileges granted on the same object
by two different roles are distinct, and you can only revoke the ones
you granted.  Which AFAICT is required behavior per SQL spec.

regards, tom lane

-- 
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 use read uncommitted transaction level and set update order

2009-12-28 Thread Jaime Casanova
On Sat, Dec 19, 2009 at 7:16 PM, Christophe Pettus  wrote:
>
>> I understand that it is not possible to read previous rows without
>> creating hack using triggers.
>
> As noted above, that's not correct.  You cannot access new values of a
> particular row within a single UPDATE statement, but you do see new values
> done in the same transaction.
>

what´s the problem with something as simple as:

create function keep_a_in_b_test1() returns trigger as $$
begin
   new.b = old.a;
   return new;
end;
$$ language plpgsql;

create trigger trg_keep_a_in_b_test1 before update
on test1 for each row execute procedure keep_a_in_b_test1();

-- 
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157

-- 
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] cross-database time extract?

2009-12-28 Thread Israel Brewster


On Dec 24, 2009, at 12:53 PM, Adrian Klaver wrote:


On Thursday 24 December 2009 1:44:58 pm Israel Brewster wrote:

This is sort of a PostgreSQL question/sort of a general SQL question,
so I apologize if this isn't the best place to ask. At any rate, I
know in PostgreSQL you can issue a command like 'SELECT
"time"(timestamp_column) from table_name' to get the time part of a
timestamp. The problem is that this command for some reason requires
quotes around the "time" function name, which breaks the command when
used in SQLite (I don't know about MySQL yet, but I suspect the same
would be true there). The program I am working on is designed to work
with all three types of databases (SQLite, PostgreSQL, and MySQL) so
it would be nice (save me some programing) if there was a single SQL
statement to get the time portion of a timestamp that would work with
all three. Is there such a beast? On a related note, why do we need
the quotes around "time" for the function to work in PostgreSQL? the
date function doesn't need them, so I know it's not just a general
PostgreSQL formating difference. Thanks :)
---
Israel Brewster
Computer Support Technician II
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
---


select cast(timestamp_column as time) from table_name


Didn't realize you could do that- thanks. This does work, sort of...  
In PosgreSQL, it returns the time portion of the timestamp as desired.  
However, in SQLite, while the function runs, it returns the year  
portion of the timestamp, rather than the time. That would seem to be  
a SQLite issue/question however. Thanks for the suggestion.




--
Adrian Klaver
akla...@comcast.net

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


---
Israel Brewster
Computer Support Technician II
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
---

BEGIN:VCARD
VERSION:3.0
N:Brewster;Israel;;;
FN:Israel Brewster
ORG:Frontier Flying Service;MIS
TITLE:PC Support Tech II
EMAIL;type=INTERNET;type=WORK;type=pref:isr...@frontierflying.com
TEL;type=WORK;type=pref:907-450-7293
item1.ADR;type=WORK;type=pref:;;5245 Airport Industrial Wy;Fairbanks;AK;99701;
item1.X-ABADR:us
CATEGORIES:General
X-ABUID:36305438-95EA-4410-91AB-45D16CABCDDC\:ABPerson
END:VCARD




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


[GENERAL] unsubscribe remove

2009-12-28 Thread Mark Williamson



[GENERAL] DB Link Question

2009-12-28 Thread Alex -

Hi,is there away to check with DB Link if one record exists/not exists in a 
remote database?
Something like...
SELECT item_id FROM TABLE A WHERE NOT EXISTS (SELECT 1 FROM TABLE B WHERE 
A.item_id=B.item_id)
Where Table A is on a Local machine and Table B is on a remote machine.
Thanks for any help on that.
Alex  
_
A world FIRST in property search has arrived! Check out Domain Radar NOW!
http://clk.atdmt.com/NMN/go/157631292/direct/01/

[GENERAL] pg_dump excluding tables content but not table schema

2009-12-28 Thread Ivan Sergio Borgonovo
I've some tables that are just cache.

I'd like to just dump the table schema without dumping the table
contend.

I think I could do it in 2 steps but I'd like to avoid it.

Is there a way?

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] pg_dump excluding tables content but not table schema

2009-12-28 Thread Raymond O'Donnell
On 28/12/2009 18:41, Ivan Sergio Borgonovo wrote:

> I'd like to just dump the table schema without dumping the table
> contend.

pg_dump -s -t  


Ray.


-- 
Raymond O'Donnell :: Galway :: Ireland
r...@iol.ie

-- 
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] cross-database time extract?

2009-12-28 Thread Greenhorn
2009/12/29 Israel Brewster :
>
> On Dec 24, 2009, at 12:53 PM, Adrian Klaver wrote:
>
>> On Thursday 24 December 2009 1:44:58 pm Israel Brewster wrote:
>>>
>>> This is sort of a PostgreSQL question/sort of a general SQL question,
>>> so I apologize if this isn't the best place to ask. At any rate, I
>>> know in PostgreSQL you can issue a command like 'SELECT
>>> "time"(timestamp_column) from table_name' to get the time part of a
>>> timestamp. The problem is that this command for some reason requires
>>> quotes around the "time" function name, which breaks the command when
>>> used in SQLite (I don't know about MySQL yet, but I suspect the same
>>> would be true there). The program I am working on is designed to work
>>> with all three types of databases (SQLite, PostgreSQL, and MySQL) so
>>> it would be nice (save me some programing) if there was a single SQL
>>> statement to get the time portion of a timestamp that would work with
>>> all three. Is there such a beast? On a related note, why do we need
>>> the quotes around "time" for the function to work in PostgreSQL? the
>>> date function doesn't need them, so I know it's not just a general
>>> PostgreSQL formating difference. Thanks :)
>>> ---
>>> Israel Brewster
>>> Computer Support Technician II
>>> Frontier Flying Service Inc.
>>> 5245 Airport Industrial Rd
>>> Fairbanks, AK 99709
>>> (907) 450-7250 x293
>>> ---
>>
>> select cast(timestamp_column as time) from table_name
>

you could try select timestamp_column::time from table_name

-- 
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_dump excluding tables content but not table schema

2009-12-28 Thread Ivan Sergio Borgonovo
On Mon, 28 Dec 2009 19:39:36 +
Raymond O'Donnell  wrote:

> On 28/12/2009 18:41, Ivan Sergio Borgonovo wrote:
> 
> > I'd like to just dump the table schema without dumping the table
> > contend.

> pg_dump -s -t  

My fault. I was not clear enough.
I'd like to make a "mostly" full backup, excluding from backup just
the data of some tables but backing up the schema of those tables.

mmm let me try if

pg_dump -Fc -Z9 -s -t *.cache* -d mydb > schema_only.bak
pg_dump -Fc -Z9 -T *.cache* -d mydb > nearly_full.bak

cat nearly_full.bak schema_only.bak | pg_restore -1 -d mydb

It seems it is working... I'll test if everything is there.

-- 
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_dump excluding tables content but not table schema

2009-12-28 Thread Raymond O'Donnell
On 28/12/2009 20:20, Ivan Sergio Borgonovo wrote:
> On Mon, 28 Dec 2009 19:39:36 +
> Raymond O'Donnell  wrote:
> 
>> On 28/12/2009 18:41, Ivan Sergio Borgonovo wrote:
>>
>>> I'd like to just dump the table schema without dumping the table
>>> contend.
> 
>> pg_dump -s -t  
> 
> My fault. I was not clear enough.
> I'd like to make a "mostly" full backup, excluding from backup just
> the data of some tables but backing up the schema of those tables.
> 
> mmm let me try if
> 
> pg_dump -Fc -Z9 -s -t *.cache* -d mydb > schema_only.bak
> pg_dump -Fc -Z9 -T *.cache* -d mydb > nearly_full.bak
> 
> cat nearly_full.bak schema_only.bak | pg_restore -1 -d mydb
> 
> It seems it is working... I'll test if everything is there.

I don't think you can do it in one step with a single invocation of
pg_dump - I reckon what you've come up with there is the way to go.

Ray.

-- 
Raymond O'Donnell :: Galway :: Ireland
r...@iol.ie

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


[GENERAL] pg_dump ERROR, usename "postgres" duplicated

2009-12-28 Thread Gastón Quiroga

Hi:
   I cannot dump any database from my server. When I try to do it i 
receive this error


pg_dump: The command was: SELECT tableoid, oid, nspname, (select usename 
from pg_user where nspowner = usesysid) as usename, nspacl FROM pg_namespace


   I checked the pg_user database and I found this:

postgres=# select * from pg_user;
   usename| usesysid | usecreatedb | usesuper | usecatupd |  
passwd  | valuntil | useconfig

---+--+-+--+---+--+--+---
postgres  |1 | t   | t| t | 
 |  |
postgres  |1 | t   | t| t | 
 |  |
administrador |  100 | t   | t| t | 
 |  |
user1 |  101 | t   | t| t | 
 |  |
user2 |  102 | f   | f| f | 
 |  |


   Anyone can tell me from where should I start?. This is a production 
server.



Regards.

--
Gastón Quiroga





[GENERAL] pg_dump ERROR, usename "postgres" duplicated

2009-12-28 Thread Gastón

Hi:
   I cannot dump any database from my server. When I try to do it i 
receive this error


pg_dump: The command was: SELECT tableoid, oid, nspname, (select usename 
from pg_user where nspowner = usesysid) as usename, nspacl FROM pg_namespace


   I checked the pg_user database and I found this:

postgres=# select * from pg_user;
   usename| usesysid | usecreatedb | usesuper | usecatupd |  
passwd  | valuntil | useconfig

---+--+-+--+---+--+--+---
postgres  |1 | t   | t| t | 
 |  |
postgres  |1 | t   | t| t | 
 |  |
administrador |  100 | t   | t| t | 
 |  |
user1 |  101 | t   | t| t | 
 |  |
user2 |  102 | f   | f| f | 
 |  |


   Anyone can tell me from where should I start?. This is an old 
production server (version 8.0.8).



Regards.

--
Gastón 



Re: [GENERAL] Java Postgres drivers.

2009-12-28 Thread John R Pierce

Ivano Luberti wrote:

Sure the url looks bad.
Shoudl be something like:

http://jdbc.postgresql.org/dbname
  


say huh?

http://jdbc.postgresql.org/documentation/84/load.html
http://jdbc.postgresql.org/documentation/84/connect.html

says what he's doing is fine.


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


[GENERAL] pg_dump ERROR, usename "postgres" duplicated

2009-12-28 Thread Gastón

Hi:
   I cannot dump any database from my server. When I try to do it i 
receive this error


pg_dump: The command was: SELECT tableoid, oid, nspname, (select usename 
from pg_user where nspowner = usesysid) as usename, nspacl FROM pg_namespace


   I checked the pg_user database and I found this:

postgres=# select * from pg_user;
   usename| usesysid | usecreatedb | usesuper | usecatupd |  
passwd  | valuntil | useconfig

---+--+-+--+---+--+--+---
postgres  |1 | t   | t| t | 
 |  |
postgres  |1 | t   | t| t | 
 |  |
administrador |  100 | t   | t| t | 
 |  |
user1 |  101 | t   | t| t | 
 |  |
user2 |  102 | f   | f| f | 
 |  |


   Anyone can tell me from where should I start?. This is an old 
production server (version 8.0.8).



Regards.

--
Gastón Quiroga
Allytech S.A.



Re: [GENERAL] pg_dump ERROR, usename "postgres" duplicated

2009-12-28 Thread Tom Lane
=?ISO-8859-1?Q?Gast=F3n_Quiroga?=  writes:
> I checked the pg_user database and I found this:

> postgres=# select * from pg_user;
> usename| usesysid | usecreatedb | usesuper | usecatupd |  
> passwd  | valuntil | useconfig
> ---+--+-+--+---+--+--+---
>  postgres  |1 | t   | t| t | 
>  |  |
>  postgres  |1 | t   | t| t | 
>  |  |
>  administrador |  100 | t   | t| t | 
>  |  |

What PG version is that?  (Apparently pre-8.1, but what exactly?)

It would be useful to look at the underlying table:

select ctid,xmin,xmax,* from pg_shadow;

regards, tom lane

-- 
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_dump ERROR, usename "postgres" duplicated

2009-12-28 Thread Gastón

Thanks for your reply Tom, and sorry for the duplicated e-mails.

It's Postgres version 8.0.8


Thank you

Gastón Quiroga
Allytech S.A.



Tom Lane wrote:

=?ISO-8859-1?Q?Gast=F3n_Quiroga?=  writes:
  

I checked the pg_user database and I found this:



  

postgres=# select * from pg_user;
usename| usesysid | usecreatedb | usesuper | usecatupd |  
passwd  | valuntil | useconfig

---+--+-+--+---+--+--+---
 postgres  |1 | t   | t| t | 
 |  |
 postgres  |1 | t   | t| t | 
 |  |
 administrador |  100 | t   | t| t | 
 |  |



What PG version is that?  (Apparently pre-8.1, but what exactly?)

It would be useful to look at the underlying table:

select ctid,xmin,xmax,* from pg_shadow;

regards, tom lane

  


Re: [GENERAL] pg_dump ERROR, usename "postgres" duplicated

2009-12-28 Thread Tom Lane
=?ISO-8859-1?Q?Gast=F3n?=  writes:
> It's Postgres version 8.0.8

Well, that's pretty ancient, and I see at least one bug in the release
history that could result in duplicated rows.  I'd counsel an update to
8.0.something-recent.  You can probably delete the extra row using
a WHERE on ctid.

regards, tom lane

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


[GENERAL] parse tree in XML format

2009-12-28 Thread matt
Is there some way to export the postgresql query parse tree in XML format? I 
can not locate the API/Tool etc to do that...

thanks
-Matt


  

-- 
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] parse tree in XML format

2009-12-28 Thread Tom Lane
matt  writes:
> Is there some way to export the postgresql query parse tree in XML format?

No, and it probably wouldn't be very useful to you if there was, because
we feel free to whack the internal parsetree representation around in
every release.

regards, tom lane

-- 
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] Java Postgres drivers.

2009-12-28 Thread Ivano Luberti
Oh sorry, cut and paste mistake
By the way using that syntax he is using he is assuming the server is
running on localhost and the port is the default one

John R Pierce ha scritto:
> Ivano Luberti wrote:
>> Sure the url looks bad.
>> Shoudl be something like:
>>
>> http://jdbc.postgresql.org/dbname
>>   
>
> say huh?
>
> http://jdbc.postgresql.org/documentation/84/load.html
> http://jdbc.postgresql.org/documentation/84/connect.html
>
> says what he's doing is fine.
>
>

-- 
==
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.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] Why grantor is owner in this case?

2009-12-28 Thread Erik Jones

On Dec 27, 2009, at 6:59 PM, donniehan wrote:

> Hi Tom,
>  
> Thanks for your information. One more question, if i wanna get the accurate 
> information about grantor(Sometimes the application just needs the 
> information), what can i do?
> Apparently i cannot get from the acls, so where can i get the info?
>  
> -Dongni

First, please, trim posts and don't top post, it makes it confusing for others 
to follow along with what's currently being discussed in a thread when you 
don't do either.

As to how you can determine who *actually* made a particular grant, there isn't 
any built-in way.  What you'd need to do is wrap your GRANT statements in 
functions that log what was done and by whom to a table and then consult that 
log table when you need that info.

Erik Jones, Database Administrator
Engine Yard
Support, Scalability, Reliability
866.518.9273 x 260
Location: US/Pacific
IRC: mage2k






-- 
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] cross-database time extract?

2009-12-28 Thread Adrian Klaver
On Monday 28 December 2009 12:13:46 pm Greenhorn wrote:
> 2009/12/29 Israel Brewster :
> > On Dec 24, 2009, at 12:53 PM, Adrian Klaver wrote:
> >> On Thursday 24 December 2009 1:44:58 pm Israel Brewster wrote:
> >>> This is sort of a PostgreSQL question/sort of a general SQL question,
> >>> so I apologize if this isn't the best place to ask. At any rate, I
> >>> know in PostgreSQL you can issue a command like 'SELECT
> >>> "time"(timestamp_column) from table_name' to get the time part of a
> >>> timestamp. The problem is that this command for some reason requires
> >>> quotes around the "time" function name, which breaks the command when
> >>> used in SQLite (I don't know about MySQL yet, but I suspect the same
> >>> would be true there). The program I am working on is designed to work
> >>> with all three types of databases (SQLite, PostgreSQL, and MySQL) so
> >>> it would be nice (save me some programing) if there was a single SQL
> >>> statement to get the time portion of a timestamp that would work with
> >>> all three. Is there such a beast? On a related note, why do we need
> >>> the quotes around "time" for the function to work in PostgreSQL? the
> >>> date function doesn't need them, so I know it's not just a general
> >>> PostgreSQL formating difference. Thanks :)
> >>> ---
> >>> Israel Brewster
> >>> Computer Support Technician II
> >>> Frontier Flying Service Inc.
> >>> 5245 Airport Industrial Rd
> >>> Fairbanks, AK 99709
> >>> (907) 450-7250 x293
> >>> ---
> >>
> >> select cast(timestamp_column as time) from table_name
>
> you could try select timestamp_column::time from table_name

That would work in Postgres, but the OP was looking for a cast method that 
would 
also work in MySQL and SQLite. The cast(value as type) is SQL standard :) The 
question remains why SQLite is not behaving correctly? Datetime awareness in 
SQLite is still relatively new, I will have to do some exploring on that issue.

-- 
Adrian Klaver
akla...@comcast.net

-- 
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] cross-database time extract?

2009-12-28 Thread Scott Marlowe
On Mon, Dec 28, 2009 at 6:34 PM, Adrian Klaver  wrote:
> On Monday 28 December 2009 12:13:46 pm Greenhorn wrote:
>> 2009/12/29 Israel Brewster :
>> > On Dec 24, 2009, at 12:53 PM, Adrian Klaver wrote:
>> >> On Thursday 24 December 2009 1:44:58 pm Israel Brewster wrote:
>> >>> This is sort of a PostgreSQL question/sort of a general SQL question,
>> >>> so I apologize if this isn't the best place to ask. At any rate, I
>> >>> know in PostgreSQL you can issue a command like 'SELECT
>> >>> "time"(timestamp_column) from table_name' to get the time part of a
>> >>> timestamp. The problem is that this command for some reason requires
>> >>> quotes around the "time" function name, which breaks the command when
>> >>> used in SQLite (I don't know about MySQL yet, but I suspect the same
>> >>> would be true there). The program I am working on is designed to work
>> >>> with all three types of databases (SQLite, PostgreSQL, and MySQL) so
>> >>> it would be nice (save me some programing) if there was a single SQL
>> >>> statement to get the time portion of a timestamp that would work with
>> >>> all three. Is there such a beast? On a related note, why do we need
>> >>> the quotes around "time" for the function to work in PostgreSQL? the
>> >>> date function doesn't need them, so I know it's not just a general
>> >>> PostgreSQL formating difference. Thanks :)
>> >>> ---
>> >>> Israel Brewster
>> >>> Computer Support Technician II
>> >>> Frontier Flying Service Inc.
>> >>> 5245 Airport Industrial Rd
>> >>> Fairbanks, AK 99709
>> >>> (907) 450-7250 x293
>> >>> ---
>> >>
>> >> select cast(timestamp_column as time) from table_name
>>
>> you could try select timestamp_column::time from table_name
>
> That would work in Postgres, but the OP was looking for a cast method that 
> would
> also work in MySQL and SQLite. The cast(value as type) is SQL standard :) The
> question remains why SQLite is not behaving correctly? Datetime awareness in
> SQLite is still relatively new, I will have to do some exploring on that 
> issue.

Also, MySQL's time math is basically functionally retarded when you
start trying to set timezones.

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


[GENERAL] Installation of Postgis/postgresql

2009-12-28 Thread Nick
Trying to install postgis on LINUX machine, need to find the geos-
config file, as seems it is no where to be found after download of
postgis in the ./configure step, is there anyone that can give me a
clue on how to find this file? Ultimate goal is to get postgis working
so we can use geom data type in the tables on postgresql, and to get
php to be able to talk to postgresql when scripts are run using
pg_connect function.

during ./configure of postGIS errors out looking for geos-config

during ./configure of geos errors out looking for g++

to the best of my knowledge g++ is part of gcc and we have a current
version of the gcc compiler on the computer

Thanks,
Nick

-- 
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] Installation of Postgis/postgresql

2009-12-28 Thread Paul Ramsey
Nick,
You'll find GEOS questions get answered better on the GEOS mailing
list (http://lists.osgeo.org/mailman/listinfo/geos-devel), BUT:

If ./configure is not finding g++ then odds are, you don't have it
installed (type g++ on the commandline, see what happens). Use your
package manager to do a search for "g++" or "c++" and find out which
package hold it, then install it. Keep working on getting GEOS built
and installed, you can't proceed with PostGIS until you get past that
step.

Also build and install Proj4 (http://trac.osgeo.org/proj) before
proceeding with PostGIS.

Best,

Paul

Also, your PostGIS questions will be better answered on
http://postgis.refractions.net/mailman/listinfo/postgis-users

On Mon, Dec 28, 2009 at 6:24 PM, Nick  wrote:
> Trying to install postgis on LINUX machine, need to find the geos-
> config file, as seems it is no where to be found after download of
> postgis in the ./configure step, is there anyone that can give me a
> clue on how to find this file? Ultimate goal is to get postgis working
> so we can use geom data type in the tables on postgresql, and to get
> php to be able to talk to postgresql when scripts are run using
> pg_connect function.
>
> during ./configure of postGIS errors out looking for geos-config
>
> during ./configure of geos errors out looking for g++
>
> to the best of my knowledge g++ is part of gcc and we have a current
> version of the gcc compiler on the computer
>
> Thanks,
> Nick
>
> --
> 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] Installation of Postgis/postgresql

2009-12-28 Thread Andy Colson

On 12/28/2009 08:24 PM, Nick wrote:

Trying to install postgis on LINUX machine, need to find the geos-
config file, as seems it is no where to be found after download of
postgis in the ./configure step, is there anyone that can give me a
clue on how to find this file? Ultimate goal is to get postgis working
so we can use geom data type in the tables on postgresql, and to get
php to be able to talk to postgresql when scripts are run using
pg_connect function.

during ./configure of postGIS errors out looking for geos-config

during ./configure of geos errors out looking for g++

to the best of my knowledge g++ is part of gcc and we have a current
version of the gcc compiler on the computer

Thanks,
Nick


if you type 'g++' and hit return, do you get the message: 'g++: no input files'

What distro are you running?

-Andy

--
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] Installation of Postgis/postgresql

2009-12-28 Thread Devrim GÜNDÜZ
On Mon, 2009-12-28 at 18:24 -0800, Nick wrote:
> Trying to install postgis on LINUX machine,

Which Linux? Many distros have PostGIS and related stuff in their
repositories. You don't need to compile them.

> need to find the geos-config file, as seems it is no where to be found
> after download of postgis in the ./configure step, is there anyone
> that can give me a clue on how to find this file? 

You need to *install* Geos first, before installing PostGIS.
> during ./configure of geos errors out looking for g++
> 
> to the best of my knowledge g++ is part of gcc and we have a current
> version of the gcc compiler on the computer

c++ is a separate package, generally gcc-c++ or such.
-- 
Devrim GÜNDÜZ, RHCE
Command Prompt - http://www.CommandPrompt.com 
devrim~gunduz.org, devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org  Twitter: http://twitter.com/devrimgunduz


signature.asc
Description: This is a digitally signed message part


Re: [GENERAL] Installation of Postgis/postgresql

2009-12-28 Thread Nick
On Dec 28, 7:20 pm, a...@squeakycode.net (Andy Colson) wrote:
> On 12/28/2009 08:24 PM, Nick wrote:
>
>
>
> > Trying to install postgis on LINUX machine, need to find the geos-
> > config file, as seems it is no where to be found after download of
> > postgis in the ./configure step, is there anyone that can give me a
> > clue on how to find this file? Ultimate goal is to get postgis working
> > so we can use geom data type in the tables on postgresql, and to get
> > php to be able to talk to postgresql when scripts are run using
> > pg_connect function.
>
> > during ./configure of postGIS errors out looking for geos-config
>
> > during ./configure of geos errors out looking for g++
>
> > to the best of my knowledge g++ is part of gcc and we have a current
> > version of the gcc compiler on the computer
>
> > Thanks,
> > Nick
>
> if you type 'g++' and hit return, do you get the message: 'g++: no input 
> files'
>
> What distro are you running?
>
> -Andy
>
> --
> Sent via pgsql-general mailing list (pgsql-gene...@postgresql.org)
> To make changes to your 
> subscription:http://www.postgresql.org/mailpref/pgsql-general

'g++' or g++ says -bash g++: command not found

distro is red hat

-- 
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] Installation of Postgis/postgresql

2009-12-28 Thread Tom Lane
Nick  writes:
> 'g++' or g++ says -bash g++: command not found

So you haven't got it installed.

> distro is red hat

"Red Hat" is pretty darn nonspecific, but on recent Fedora g++ is
part of the gcc-c++ package.

regards, tom lane

-- 
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] Installation of Postgis/postgresql

2009-12-28 Thread John R Pierce

Nick wrote:

'g++' or g++ says -bash g++: command not found

distro is red hat
  


Assuming thats RHEL5,

   yum install gcc-c++


if its RHEL4 or earlier, use up2date instead.   either of these will 
require a RHN subscription to be activated. 


if it is in fact, centos 3,4,5,

   yum install gcc-c++

and you don't need any subscription


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