[SQL] Function To Log Changes

2004-04-05 Thread Gavin
Hi All, I have been tinkering with a function to log the changes made on any column through a function and trigger. However, I cant think of a way to make this work through pl/pgsql. Any one have any ideas, or is it just not possible? SNIP create or replace function logchange2() returns OPAQUE a

[SQL] Entered data appears TWICE in table!!?

2004-04-05 Thread Ron M.
I'm JUST getting started with the online SQL tutorial at http://sqlcourse.com. When I create a table and insert data, the data appears TWICE. A simple example: ***Create the table: create table rnmrgntable (first varchar(20), last varchar(30)); ***Insert data: insert into rnmrgntable (first, l

Re: [SQL] Invalid Unicode Character Sequence found

2004-04-05 Thread Bulatovic Natasa
Yes, indeed very strange. However, it is certainly fixed, because I also tried more advanced version of postgres and this bug was not in there. Regards Natasa > -Original Message- > From: Markus Bertheau [mailto:[EMAIL PROTECTED] > Sent: Saturday, March 27, 2004 11:02 AM > To: Tom Lane >

Re: [SQL] DB question - Merging data from one table to another.

2004-04-05 Thread malia, sean
Title: RE: DB question - Merging data from one table to another. Hello, I'm not sure if this is even possible, but I'll throw it by you anyway.  Say I have 2 tables: Table1:  With columns number and name 1.1 test1 1.2 test2 1.3     test3 1.4 test4 Table2: With column nu

Re: [SQL] Function To Log Changes

2004-04-05 Thread Josh Berkus
Gavin, > Hi All, I have been tinkering with a function to log the changes made on > any column through a function and trigger. However, I cant think of a way > to make this work through pl/pgsql. Any one have any ideas, or is it just > not possible? It could be done, but would be extremely slow

[SQL] Getting the ranks of results from a query

2004-04-05 Thread abhi
I have a query of the form select id from member order by age; id - 431 93 202 467 300 In addition to the id, I would like the get the rank of the row-- in other words: id | rank -+--- 431 | 1 93 | 2 202 | 3 467 | 4 300 | 5 How do I do this with postgres? In the pa

Re: [SQL] order of results

2004-04-05 Thread Gregor Rot
Bruno Wolff III wrote: On Thu, Mar 25, 2004 at 14:23:00 +0100, Gregor Rot <[EMAIL PROTECTED]> wrote: Hi, i have a table called "people" (name:varchar, lastname:varchar). i do a select on it: select * from people where name like '%n1%' or lastname like '%l1%'. i would like the results in this

[SQL] Question on pgsql trigger

2004-04-05 Thread Jon Poulton
Hi there, Im having a go at writing my first set of triggers for postgres and Im having trouble with an error message which the trigger produces when it tries to compile/call the function Ive written in pgsql. The error message is: ERROR: syntax error at or near ";" CONTEXT: compile of PL/pgSQL

[SQL] oracle varray functionality?

2004-04-05 Thread Postgres User
I've run across a custom type in an oracle database that I am porting to PostGreSQL: create or replace type number_varray as varray(1000) of number; Is the int4array example the same as this? create type int4array(input=int4array_in,output=int4array_out, internallength=variable,element=int4)

[SQL] group by not returning sorted rows

2004-04-05 Thread Bret Hughes
I have a query: select cities.name as city, buildings.name as building, pagename, log_date , sum(exhibition_count) as tot from logrecords join cities on (logrecords.city=cities.num) join buildings on (logrecords.building=buildings.num) where adver

Re: [SQL] Function To Log Changes

2004-04-05 Thread Tom Lane
"Gavin" <[EMAIL PROTECTED]> writes: > Hi All, I have been tinkering with a function to log the changes made on > any column through a function and trigger. However, I cant think of a way > to make this work through pl/pgsql. plpgsql won't do it, but you could do it in pltcl, I believe. Or resort

Re: [SQL] DB question - Merging data from one table to another.

2004-04-05 Thread scott.marlowe
On Thu, 1 Apr 2004, malia, sean wrote: > Hello, > > I'm not sure if this is even possible, but I'll throw it by you anyway. > > Say I have 2 tables: > > Table1: With columns number and name > > 1.1 test1 > 1.2 test2 > 1.3 test3 > 1.4 test4 > > Table2: With column number and result

Re: [SQL] group by not returning sorted rows

2004-04-05 Thread Stephan Szabo
On Mon, 5 Apr 2004, Bret Hughes wrote: > select cities.name as city, buildings.name as building, > pagename, > log_date , > sum(exhibition_count) as tot > from logrecords > join cities on (logrecords.city=cities.num) > join buildings on (logrecords.building=buildings.

Re: [SQL] Question on pgsql trigger

2004-04-05 Thread Jeff Eckermann
--- Jon Poulton <[EMAIL PROTECTED]> wrote: > Hi there, > Im having a go at writing my first set of triggers > for postgres and Im > having trouble with an error message which the > trigger produces when it > tries to compile/call the function Ive written in > pgsql. The error message > is: > > ERR

Re: [SQL] group by not returning sorted rows

2004-04-05 Thread Tom Lane
Bret Hughes <[EMAIL PROTECTED]> writes: > and the rows resulting from the query are no longer sorted by log date. > Is this a change since 7.2x? Yes. 7.4 can use hashing instead of sorting to bring grouped rows together. > I can achieve the results I need by adding an order by clause identical

Re: [SQL] Entered data appears TWICE in table!!?

2004-04-05 Thread Jeff Eckermann
What interface are you using? --- "Ron M." <[EMAIL PROTECTED]> wrote: > I'm JUST getting started with the online SQL > tutorial at > http://sqlcourse.com. When I create a table and > insert data, the data > appears TWICE. A simple example: > > ***Create the table: > > create table rnmrgntable >