[SQL] Data Calculation

2003-09-29 Thread Ogden
I need some help for which I could not find much help for within the Postgres book I am looking at, or the online tutorial. I don't know if this is even possible, but here goes... I am writing for advice, as the method I followed is not the most effecient, I think. Scenario: Grading results. I ha

[SQL] Change of the datatype of a column

2003-09-29 Thread shyamperi
1:16p Dear all, How is that I can alter the datatype of the column . - Warm Regards Shÿam Peri II Floor, Punja Building, M.G.Road, Ballalbagh, Mangalore-575003 Ph : 91-824-2451001/5 Fax : 91-824-2451050 DISCLAIMER: This message contains privileged and confidential information and is inten

[SQL]

2003-09-29 Thread marcello miorelli
= Marcello Miorelli - SoftByte Systems Ltda. 55 54 224 42 00 # 210 Senior Software Engineer Software Developer Languages: C, C++,VB, Delphi, SQL,Assembly Databases: Interbase, PostgreSQL, MS SQL Server, Oracle Stored Procedures, Triggers and User Defined Functions Hare Krishna Hare Krishn

[SQL] BLOBS AND FILES

2003-09-29 Thread marcello miorelli
Hello folks, How can we insert a file into a blob field in a table? Could someone please explain something regarding this? It is ver important. tia marcello miorelli __ Yahoo! Mail: 6MB di spazio gratuito, 30MB per i tuoi alleg

Re: [SQL] Data Calculation

2003-09-29 Thread Christoph Haller
According to your scenario I did the following create table answerkey ( question_number int, answer varchar(2)); create table studentanswer ( student_id varchar(6), answer01 varchar(2), answer02 varchar(2)); insert into answerkey values(1,'A'); insert into answerkey values(2,'B'); insert into stu

[SQL] now() in loop statement

2003-09-29 Thread Kerv
Hello, What is wrong with this function because the mytime variable contain the same value in each iteration: CREATE OR REPLACE FUNCTION public.time_test() RETURNS int4 AS ' DECLARE count int4; mytime timestamp; BEGIN count := 0; mytime := now(); while count <= 25 loop mytime := now();

Re: [SQL] now() in loop statement

2003-09-29 Thread Tomasz Myrta
Hello, What is wrong with this function because the mytime variable contain the same value in each iteration: Just like it should be. now() gives you always the same value inside single transaction. If you need time for performance tests - use "timeofday". Regards, Tomasz Myrta

Re: [SQL] now() in loop statement

2003-09-29 Thread Christoph Haller
> > Hello, > > What is wrong with this function because the mytime variable contain the > same value in each iteration: > CREATE OR REPLACE FUNCTION public.time_test() >RETURNS int4 AS > ' > DECLARE > count int4; > mytime timestamp; > BEGIN > count := 0; > mytime := n

Re: [SQL] now() in loop statement

2003-09-29 Thread Dan Langille
On 29 Sep 2003 at 15:58, Kerv wrote: > What is wrong with this function because the mytime variable contain the > same value in each iteration: >From http://www.postgresql.org/docs/7.3/static/functions- datetime.html: It is important to realize that CURRENT_TIMESTAMP and related functions retu

Re: [SQL]

2003-09-29 Thread Jean-Luc Lachance
Wouldn't: insert into r select count(*) from users where date( lastlogin) > current_date - MaxDays * interval '' 1 day'' group by date( lastlogin); be more efficient? Tom Lane wrote: > > Dan Langille <[EMAIL PROTECTED]> writes: > > WHERE lastlogin between current_date - interval \

Re: [SQL]

2003-09-29 Thread Dan Langille
On 29 Sep 2003 at 10:04, Jean-Luc Lachance wrote: > Wouldn't: > > insert into r > select count(*) > from users > where date( lastlogin) > current_date - MaxDays * interval '' 1 day'' > group by date( lastlogin); > > be more efficient? Yes it would, by a factor of 5. freshports=# explain an

[SQL] SRF Functions don't want to return empty tuple

2003-09-29 Thread GRIMOIS Eric
Hi I have a problem with SRF functions on a RedHat 8.0 system with PostgreSQL 7.3.2. Schema is following : CREATE TABLE public.agents ( numero_age int4 NOT NULL, nom_age varchar(30) NOT NULL, prenom_age varchar(30) NOT NULL, date_entree_age date NOT NULL, identite varchar(50), CONSTR

[SQL] Thanks for all replies

2003-09-29 Thread Kerv
Thank you, Kerv ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html

Re: [SQL] Especial delimiters caracter

2003-09-29 Thread Montervino, Mariano
Thanks for your replay... I resolve the problem with sed before i post the question. But a really want to know if i can handle all with posgre script. Mariano -Mensaje original- De: Richard Huxton [mailto:[EMAIL PROTECTED] Enviado el: Miércoles, 24 de Septiembre de 2003 14:19 Para: Monter

[SQL] Need to overcome UNION / ORDER BY restriction

2003-09-29 Thread Timo
I have a table: id | priority | seniority -+--+--- 902 |2 | 271 902 |1 | 271 902 |3 | 271 924 |2 | 581 924 |1 | 581 924 |3 | 581 935 |1 | 276 935 |2 | 276

[SQL] Problems to be solved as soon as possible

2003-09-29 Thread The Guardian
Dear Support Team, We are hosting a website which was originally designed in some version of Debian Linux and having PostgreSQL as back end. The developers have made a script which creates several tables in the database. Some of the tables have datatypes like DateTime. When i run those scr

[SQL] SQL Syntax problem

2003-09-29 Thread Doris Bernloehr
Hello. I've got a problem in porting the following select statement from Oracle to Postgres, because of the characters after "b.bet_id" and "f.ask_id" in the where clause: (+) I don't know what these characters mean and how I can transform these into PostgreSql Syntax. select... from

Re: [SQL] Need to overcome UNION / ORDER BY restriction

2003-09-29 Thread Bruno Wolff III
On Mon, Sep 29, 2003 at 17:27:47 +0300, Timo <[EMAIL PROTECTED]> wrote: > > I'd need to get a result set where rows are sorted according to these rules: > > 1. first all rows with priority = 1 sorted according to seniority > 2. then the rest of the rows sorted by seniority, priority You can do

Re: [SQL] SRF Functions don't want to return empty tuple

2003-09-29 Thread GRIMOIS Eric
- Original Message - From: "Stephan Szabo" <[EMAIL PROTECTED]> To: "GRIMOIS Eric" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, September 29, 2003 6:40 PM Subject: Re: [SQL] SRF Functions don't want to return empty tuple > > On Mon, 29 Sep 2003, GRIMOIS Eric wrote: > > > Hi >

Re: [SQL] postgres index on ILIKE

2003-09-29 Thread Josh Berkus
Alex, > I read your article about indexing in postgres which unfortunately ends > after the 2nd part. So I decided to ask you by email. Yeah, yeah, I know. The completed version will probably become part of a published book. We'll see. > Is it somehow possible to create an index for the ILIK

Re: [SQL] Oracle 'connect by prior' now eaiser in 7.3?

2003-09-29 Thread Evgen Potemkin
if you need oracle's syntax and can recompile pgsql see patch at http://gppl.terminal.ru/index.eng.html regards, evgen potemkin --- On Tue, 23 Sep 2003, Merrall, Graeme wrote: > > I'll start by admitting that I've not looked at it myself yet but I'm > just wondering if any others have looked at

Re: [SQL] SRF Functions don't want to return empty tuple

2003-09-29 Thread Richard Huxton
On Monday 29 September 2003 17:18, GRIMOIS Eric wrote: > Hi > > I have a problem with SRF functions on a RedHat 8.0 system with PostgreSQL > 7.3.2. > > Schema is following : > > CREATE TABLE public.agents ( > numero_age int4 NOT NULL, > nom_age varchar(30) NOT NULL, > prenom_age varchar(30) N

[SQL] help

2003-09-29 Thread shengqj
Hi, there       I'm attempting to install PostgreSQL-7.3.3 under Windows 2000 professional.    -cygwin-1.5.5-1    -cygipc-2.01-2      but i got trouble when performing  initdb command, all the interactive information listed as follows,   --

Re: [SQL] postgres index on ILIKE

2003-09-29 Thread Josh Berkus
Alex, > mydb=# explain select filename from neighbors where filename ilike > '%test%'; QUERY PLAN > - > Seq Scan on neighbors (cost=0.00..17449.64 rows=774 width=37) > Filter: ((filename)::text ~~* '%test%'::text) I just looked at

[SQL] does postgresql execute unions in parallel?

2003-09-29 Thread teknokrat
If I have several selects joined with unions does postgresql execute the concurrently or not? thanks ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html

Re: [SQL] SRF Functions don't want to return empty tuple

2003-09-29 Thread Stephan Szabo
On Mon, 29 Sep 2003, GRIMOIS Eric wrote: > Hi > > I have a problem with SRF functions on a RedHat 8.0 system with PostgreSQL > 7.3.2. > > Schema is following : > > CREATE TABLE public.agents ( > numero_age int4 NOT NULL, > nom_age varchar(30) NOT NULL, > prenom_age varchar(30) NOT NULL, >

[SQL] Is there something wrong with Perl's dbi and PostgreSQL?

2003-09-29 Thread Jeff Self
I just tried running a perl script that I wrote about a year ago. It had worked for me in the past. Now it doesn't work. I can view data from a table, but I am unable to either drop a table or create a table. I'm running PostgreSQL 7.3.4 and DBI 1.35 along with Perl 5.8.1. Here's my script for cre

Re: [SQL] does postgresql execute unions in parallel?

2003-09-29 Thread Bruce Momjian
teknokrat wrote: > If I have several selects joined with unions does postgresql execute the > concurrently or not? No. -- Bruce Momjian| http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Ro

Re: [SQL] SQL Syntax problem

2003-09-29 Thread Franco Bruno Borghesi
This kind of conditions are left or right joins, depending on which side of the equal sign you have the (+). Something like this select    ... from auswahlkatalog k, INNER JOIN anspruchkorrektur a ON (k.awk_id = a.awk_id), LEFT JOIN beteiligter b ON (b.bet_id = a.bet_idemp), RIGHT JOI

Re: [SQL] Need to overcome UNION / ORDER BY restriction

2003-09-29 Thread Tom Lane
"Timo" <[EMAIL PROTECTED]> writes: > SELECT * from foo where priority = 1 order by seniority > union select * from foo where priority > 1 order by seniority, priority > but this gives parse error because of the restrictions with ORDER BY and > UNION (I suppose..) You'd need to parenthesize: (

Re: [SQL] Problems to be solved as soon as possible

2003-09-29 Thread Tomasz Myrta
Dear Support Team, We are hosting a website which was originally designed in some version of Debian Linux and having PostgreSQL as back end. The developers have made a script which creates several tables in the database. Some of the tables have datatypes like DateTime. When i run those scri

Re: [SQL] SRF Functions don't want to return empty tuple

2003-09-29 Thread Stephan Szabo
On Mon, 29 Sep 2003, GRIMOIS Eric wrote: > > On Mon, 29 Sep 2003, GRIMOIS Eric wrote: > > > > > CREATE TABLE public.agents ( > > > numero_age int4 NOT NULL, > > > nom_age varchar(30) NOT NULL, > > > prenom_age varchar(30) NOT NULL, > > > date_entree_age date NOT NULL, > > > identite var

Re: [SQL] Is there something wrong with Perl`s dbi and PostgreSQL?

2003-09-29 Thread greg
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > I just tried running a perl script that I wrote about a year ago. It had > worked for me in the past. Now it doesn't work. You have AutoCommit set to off, and never commit the transaction. Therefore, the table creation is rolled back. Add a $db

Re: [SQL] Problems to be solved as soon as possible

2003-09-29 Thread Tom Lane
Tomasz Myrta <[EMAIL PROTECTED]> writes: >> datatypes like DateTime. When i run those scripts in PostgreSQL of Red hat >> Linux 7.2, they run perfectly. But when i run the same scrips in PostgreSQL >> of Redhat Linux 9.0, it displays an error message of "data type DATETIME not >> found." > It look

Re: [SQL] Problems to be solved as soon as possible

2003-09-29 Thread Josh Berkus
"The Guardian", > Dear Support Team, We are not a "support team". We are your fellow PostgreSQL users, and are helping you out of our personal generosity and desire to promote Postgres use. Nobody on this list is paid to answer your question. You are expected to "pay" for this support by, i

[SQL] Help with pivoting tables

2003-09-29 Thread Ben Schneider
Hi, I am having some diffuculty with pivoting the results of a query. I am using the following SQL in an attempt to aggreate the data from a table. --Begin Query-- SELECT groupid, activity_date, count(CASE activity_subcode WHEN 100 THEN 1 ELSE NULL END) AS Attended, count(CASE activity

Re: [SQL] Help with pivoting tables

2003-09-29 Thread Franco Bruno Borghesi
would SELECT groupid, activity_date, sum(TMP.Attended) AS Attended, sum(TMP.Unexcused) AS Unexcused, sum(TMP.Absent) AS Absent, sum(TMP.Called) AS Called FROM ( SELECT groupid, activity_date, count(CASE activity_subcode WHEN 100 THEN 1 ELSE NULL END) AS Attended, count(CASE activity

Re: [SQL]

2003-09-29 Thread Dan Langille
On 29 Sep 2003 at 10:04, Jean-Luc Lachance wrote: > Wouldn't: > > insert into r > select count(*) > from users > where date( lastlogin) > current_date - MaxDays * interval '' 1 day'' > group by date( lastlogin); > > be more efficient? Yes it would, by a factor of 5. P.S. but it would not s

[SQL] How to figure out when was a table created

2003-09-29 Thread David B
Folks, I have a list of tables for which I want to get the date they were created...and if possible the date last updateded. I suspect there is a pg_??? table that can answer this question but I don't know what it is and I cannot find it mentioned in any docs. Any suggestions...tia -D p.s. Love

[SQL] insert error

2003-09-29 Thread Suresh Basandra
Hi, I am getting the following error while executing insert command after I have started the erserver. I did not get this error when erserver was not started. I installed the latest versions of postgresql (7.3.4) and erserver (1.2). Please advise. Thanks Regards, Suresh Basandra pwtestdb=# ins

Re: [SQL] SQL Syntax problem

2003-09-29 Thread sad
> I've got a problem in porting the following select statement from Oracle to > Postgres, because of the characters after "b.bet_id" and "f.ask_id" in the > where clause: (+) > I don't know what these characters mean and how I can transform these into > PostgreSql Syntax. > > > select... >

[SQL] Conditional row grained + FK dependency oriented lazy replication

2003-09-29 Thread Achilleus Mantzios
Hi, first off, i broadcast my case to as many people as possible, maybe off topic for many, but maybe as well of interest for some. Also i speak sort of DBMirror terminology ( a great and simple tool). The problem is as follows: Tables must be replicated to remote sites (1 master, many slaves). Th

[SQL] Result set granularity..

2003-09-29 Thread Rasmus Aveskogh
Hi, Since I went from Oracle to PostgreSQL I've been missing the "invisable" column 'rownum'. I often used it to lower the granularity of my data. For example, say I have a large table containing some sort of statistical data and want to plot a graph using it. If the graph is 600 pixels wide I mi

Re: [SQL] Result set granularity..

2003-09-29 Thread scott.marlowe
On Sat, 27 Sep 2003, Rasmus Aveskogh wrote: > > Hi, > > Since I went from Oracle to PostgreSQL I've been missing the "invisable" > column 'rownum'. I often used it to lower the granularity of my data. > For example, say I have a large table containing some sort of statistical > data and want to