Re: [despammed] [SQL] Insert psql commands inside a script

2005-04-22 Thread Andreas Kretschmer
am 21.04.2005, um 17:19:23 -0500 mailte Letnes, David G. folgendes: > > I have used the psql -f /tmp/SelectCommands.sql before, but now I want > to put the sql statement right in the shell script. I haven't had any > luck. Is there a command I can use that will not point to a file for > the s

Re: [SQL] Insert psql commands inside a script

2005-04-22 Thread Michael Fuhr
On Thu, Apr 21, 2005 at 05:19:23PM -0500, Letnes, David G. wrote: > > I have used the psql -f /tmp/SelectCommands.sql before, but now I want > to put the sql statement right in the shell script. I haven't had any > luck. Is there a command I can use that will not point to a file for > the sql

Re: [SQL] Help to drop table

2005-04-22 Thread Michael Fuhr
On Fri, Apr 22, 2005 at 03:24:10PM +1000, Igor Kryltsov wrote: > > Please help to drop table with soace inside name. > > > List of relations > Schema | Name | Type | Owner > +--+---+-- > public | Facilit

Re: [SQL] Coming from Oracle SQL

2005-04-22 Thread Michael Fuhr
On Tue, Apr 19, 2005 at 09:37:19AM -0600, Veronica L Bounmixay wrote: > > I have a dumb question to ask - as I'm certain all of my future ones will > be as well. I am coming from the Oracle SQL PL/SQL side of things and > trying to get wrapped around PostgreSQL. I used to find tables in Oracle

Re: [SQL] How to select from many database ??

2005-04-22 Thread Michael Fuhr
On Tue, Apr 19, 2005 at 10:13:52AM +0700, Art - Feping wrote: > > i want to select from many databases, for example , i want to select table > master in database A, and table master in database B. > can i do it like this : " select * from A.Master, B.Master " just like > in SQL Server ?? Pos

[SQL] How to select from many database ??

2005-04-22 Thread Art - Feping
i want to select from many databases, for example , i want to select table master in database A, and table master in database B. can i do it like this : " select * from A.Master, B.Master " just like in SQL Server ?? or can somebody help me how to select many database in postgresSQL ?? Thank

Re: [SQL] tsearch2

2005-04-22 Thread Dan Feiveson
Thanks Oleg! Did as you recommended: set_curcfg('default'); got new error running query containing: to_tsquery('advanced|tech'); rank(avectors,a2); ERROR: ExecMakeTableFunctionResult: expression is not a function call Past message board suggests this is a pg error, not tsearch2 -- do you k

Re: [SQL] SQL subquery (count distinct) - Any Ideas?

2005-04-22 Thread Ramakrishnan Muralidharan
Hi I have modified the SQL query given by you and I hope the query given below will give you the correct count. SELECT U.USER_ID , U.NAME , COUNT(*) FROM USER U , CALL C , CALLER_SESSION CS WHERE C.CALLER_SESSION_ID = CS.CALLER_SESSION_ID AND U.USER_ID = CS.USER_ID AND CAST( CS.SESSION_D

[SQL] select the last post

2005-04-22 Thread etur
hi there, hi have a table called forum, and i've got this query: this query select the messages and the number of replies to the message individualy. i'm trying to select the last post of each set of replies, like we see in the foruns. does anyone can help me best regards, etur SELECT id, subject

Re: [SQL] Debet-Credit-Balance Calculation

2005-04-22 Thread Ramakrishnan Muralidharan
   Hi,      Using a table with larger data in the sub-query always eats up CPU time and it is time consuming. The below given statement uses the transaction table two times in the sub-query and for processing every record, it have to go through the same table twice in the sub-query.  I

[SQL] Coming from Oracle SQL

2005-04-22 Thread Veronica L Bounmixay
I have a dumb question to ask - as I'm certain all of my future ones will be as well.  I am coming from the Oracle SQL PL/SQL side of things and trying to get wrapped around PostgreSQL.  I used to find tables in Oracle by using the following query and hoped to find a replacement.  Better would be

Re: [SQL] SQL group select question

2005-04-22 Thread Ramakrishnan Muralidharan
Hi, The following SQL query will fetch you result based on the example given below, SELECT T.ID , T.VALUE FROM ( SELECT MAX( NUMB ) AS NUMB , NAME FROM TEST3 GROUP BY NAME ) AS A , TEST3 T WHERE A.NAME = T.NAME AND A.NUMB = T.NUMB ORDER BY T.ID DESC Regards, R.Muralidharan -

Re: [SQL] Getting the output of a function used in a where clause

2005-04-22 Thread Bill Lawrence
Thanks Tom and Rod. There are indeed several additional conditions on the "real" query which prune the search space (I formulate a quick search box and filter on Lat/Lon's within the box). Since my user interface limits the search to a 30 mile radius, there are at most 81 results (in New York city

Re: [SQL] string to date conversion

2005-04-22 Thread Ramakrishnan Muralidharan
Hi, I have tried the same in PostgreSQL 8.0.1 and it is working fine. I have used following example for testing create table test1 ( date varchar(10) ) insert into test1 values('2005/04/22') select date::timestamp from test1 Regards, R.Muralidharan -Original Message-

Re: [SQL] can a function return a virtual table?

2005-04-22 Thread Kai Hessing
Hi, and thanks for the answer ;) (*upps* just noticed, that I sent the answer accidently direct to poster^^ *sorry*) Michael Fuhr schrieb: >> I'll pick a nit and point out that the above isn't a valid query: >> >> test=> SELECT xyz, abc FROM (SELECT * FROM tablex WHERE status > -1); >> ERROR:

[SQL] How to configure postgresql to accept TCP/IP connections

2005-04-22 Thread amit kumar awasthi
  Hello sir actually i am working with Qt using postgresql i have to get connection {(database("trainee"),user("trainee"))} from the network (database remote accessing) so i have configured postgresql.conf and pg_hba.conf upto some extents the fields that i  have configured r as follows even

[SQL] php wrapper

2005-04-22 Thread Mauro Bertoli
Hi, I need a PHP wrapper for PostgreSQL... I found 1000 small "+/- identicals" wrappers but incompleted There's an "ufficial" or an suggested PHP wrapper? ___ Nuovo Yahoo! Messenger: E' molto più divertente: Audibles, Avatar, Webcam, Giochi, Ru

[SQL] Help to drop table

2005-04-22 Thread Igor Kryltsov
Please help to drop table with soace inside name. List of relations Schema | Name | Type | Owner +--+---+-- public | Facility Info| table | postgres > DROP TABLE ?? Thank you,

[SQL] Looking for a way to sum integer arrays....

2005-04-22 Thread Tony Wasson
I'd like to be able to sum up an integer array. Like so: {3,2,1} + {0,2,2} --- {3,4,3} The following solution I've been hacking on works, although I think it is far from "ideal". Is there a built in way to sum up arrays? If not, is there a better way than my crude method

Re: [SQL] 'Select INTO" in Execute (dynamic query )

2005-04-22 Thread Ramakrishnan Muralidharan
Hi,       It is not possible to access a local variable in EXECUTE Command and give a syntax error. FOR..IN..LOOP is the best option     CREATE OR REPLACE FUNCTION TestQry( vCon teXt )    RETURNS VARCHAR AS $$    DECLARE  

[SQL] Insert psql commands inside a script

2005-04-22 Thread Letnes, David G.
Title: Insert psql commands inside a script   I have used the psql -f /tmp/SelectCommands.sql before, but now I want to put the sql statement right in the shell script.  I haven't had any luck.  Is there a command I can use that will not point to a file for the sql instructions but right on

Re: [SQL] C function - other process

2005-04-22 Thread Michael Fuhr
On Fri, Apr 22, 2005 at 03:39:55PM -0400, Tom Lane wrote: > Jakub =?ISO-8859-2?Q?Wo=BCny?= <[EMAIL PROTECTED]> writes: > > I wrote a simple function: > > > signal(SIGCHLD,SIG_IGN); > > switch(fork()) > > This will NOT work. It WILL corrupt your database. You do not get to > randomly int

Re: [SQL] C function - other process

2005-04-22 Thread Tom Lane
Jakub =?ISO-8859-2?Q?Wo=BCny?= <[EMAIL PROTECTED]> writes: > I wrote a simple function: > signal(SIGCHLD,SIG_IGN); > switch(fork()) This will NOT work. It WILL corrupt your database. You do not get to randomly introduce new processes into the backend set. regard

Re: [SQL] How to install Postgres that supports 64-bit

2005-04-22 Thread Scott Marlowe
On Fri, 2005-04-22 at 00:30, Dinesh Pandey wrote: > How to install Postgres 8.0.1 that supports 64-bit integer/date-time. > > > > # ./configure --prefix=/usr/local/pgsql > --with-tclconfig=/usr/local/lib --with-tcl > > checking build system type... sparc-sun-solaris2.8 > > checking host syst

Re: [SQL] C function - other process

2005-04-22 Thread Michael Fuhr
On Fri, Apr 22, 2005 at 04:07:48PM -0400, Tom Lane wrote: > > Execing some new program is safe enough, although you might wish to > explicitly close the various sockets the backend holds to make sure > the new program doesn't maliciously scribble on them. Is there a way to find out which fds to c

Re: [SQL] C function - other process

2005-04-22 Thread Tom Lane
Michael Fuhr <[EMAIL PROTECTED]> writes: > What about fork() followed by exec*(), either explicitly or via > popen(), system(), etc.? Should these be avoided as well, or is > there a safe way to do them? I'm thinking of the case where a > user-defined function wants to invoke some external comman

[SQL] C function - other process

2005-04-22 Thread Jakub Woźny
Hello, I wrote a simple function: PG_FUNCTION_INFO_V1(my_fcn); Datum my_fcn() { int i,ret; i=0; signal(SIGCHLD,SIG_IGN); switch(fork()) { case 0: { SPI_connect(); for(i=0;i<10;i++) { SPI_exec("insert i

Re: [SQL] string to date conversion

2005-04-22 Thread Michael Fuhr
On Fri, Apr 22, 2005 at 11:30:02AM +0200, Jerome Alet wrote: > On Fri, Apr 22, 2005 at 11:21:26AM +0200, Christoph Haller wrote: > > > > select '2005/04/22'::text::timestamp ; > > timestamp > > - > > 2005-04-22 00:00:00 > > (1 row) > > > > works for me. > > It w

Re: [SQL] How do I connect with something like JDBCManager to Pos

2005-04-22 Thread KÖPFERL Robert
You are most probably missing entries in pg_hba.conf and the listen= directive in postgres.conf |-Original Message- |From: Adriaan Botha [mailto:[EMAIL PROTECTED] |Sent: Freitag, 22. April 2005 11:23 |To: 'PostgreSQL' |Subject: [SQL] How do I connect with something like JDBCManager to |Po

Re: [despammed] [SQL] How do I connect with something like JDBCManager to Postgres on Fedora Linux

2005-04-22 Thread Andreas Kretschmer
am 22.04.2005, um 11:22:50 +0200 mailte Adriaan Botha folgendes: > Hi Guys > > I'm trying to setup my postgres on Linux, I get it to create the > database and the postgres user etc. But when I'm trying to connect via > TCP/IP I get connection errors, You should edit the pg_hba.conf. Read this a

Re: [SQL] string to date conversion

2005-04-22 Thread Jerome Alet
On Fri, Apr 22, 2005 at 11:21:26AM +0200, Christoph Haller wrote: > > select '2005/04/22'::text::timestamp ; > timestamp > - > 2005-04-22 00:00:00 > (1 row) > > works for me. It works fine !!! Thanks so much for your help. I missed the '::text' intermediate co

Re: [SQL] string to date conversion

2005-04-22 Thread Christoph Haller
Jerome Alet wrote: > > Hi, > > I'm working on an existing Pg database which, please don't ask why, > stores dates as varchar attributes in the form '/MM/DD' > > I'm not allowed to modify the tables to use 'timestamp' instead, > so I'd like to convert on the fly when retrieving datas with > s

Re: [SQL] string to date conversion

2005-04-22 Thread Jerome Alet
On Fri, Apr 22, 2005 at 02:38:43PM +0530, Ramakrishnan Muralidharan wrote: > Hi, > > I have tried the same in PostgreSQL 8.0.1 and it is working fine. I have > used following example for testing > > create table test1 > ( > date varchar(10) > ) > > insert into test1 values('2005/0

[SQL] How do I connect with something like JDBCManager to Postgres on Fedora Linux

2005-04-22 Thread Adriaan Botha
Hi Guys I'm trying to setup my postgres on Linux, I get it to create the database and the postgres user etc. But when I'm trying to connect via TCP/IP I get connection errors, Can you please help Adriaan ---(end of broadcast)--- TIP 5: Have you ch

[SQL] string to date conversion

2005-04-22 Thread Jerome Alet
Hi, I'm working on an existing Pg database which, please don't ask why, stores dates as varchar attributes in the form '/MM/DD' I'm not allowed to modify the tables to use 'timestamp' instead, so I'd like to convert on the fly when retrieving datas with select. When I do : select my

Re: [SQL] RULE for mtime recording

2005-04-22 Thread Christoph Haller
Enrico Weigelt wrote: > > Hi folks, > > I'd like to write an update rule, which touches the a mtime field > (=current_timestamp) on normal update - when the mtime field isnt > explicitly set. If the update query explictly sets an mtime value, > this value has to be let through. > > my tables loo

[SQL] FW: How to install Postgres that supports 64-bit integer/date-time.

2005-04-22 Thread Dinesh Pandey
Continued…..   I solved this problem by myself.   A. For 64 bit development you need these packages installed on Solaris server: SUNWarcx, SUNWbtoox, SUNWdplx, SUNWscpux, SUNWsprox, SUNWtoox, SUNWlmsx, SUNWlmx, SUNWlibCx   Pls confirm these using the following command. pkginfo S