[SQL] unsuscribe

2005-10-24 Thread Nicolas Cornu
unsuscribe ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

[SQL]

2005-10-24 Thread Илья Конюхов
For example, consider the queres: SELECT * FROM table1 WHERE field1=1 AND field2=1; SELECT * FROM table1 WHERE field2=1 AND field1=1; These two queries are logically equivalent. But in all cases the planner generates a query plan that performs field1=1 condition, and then field2=1 condition,

Re: [SQL] Blank-padding

2005-10-24 Thread Scott Marlowe
On Sat, 2005-10-22 at 00:39, Chris Travers wrote: > Tom Lane wrote: > > >"Dean Gibson (DB Administrator)" <[EMAIL PROTECTED]> writes: > > > > > >>I remember that discussion, and I was for the change. However, upon > >>doing some testing after reading the above, I wonder if the > >>blank-strip

Re: [SQL] Blank-padding

2005-10-24 Thread Shaun Watts
I also have an issue with the blank padding at the end of my fields. Is there any way to eliminate the blank padding at the end of character fields in a table. Such as you have field X as a char(6), but storing "abc" in it. Well postgres seems to add the padding on the end of string that is bein

[SQL]

2005-10-24 Thread Илья Конюхов
> For example, consider the queres: > > SELECT * FROM table1 WHERE field1=1 AND field2=1; > > SELECT * FROM table1 WHERE field2=1 AND field1=1; > > > These two queries are logically equivalent. But in all cases the planner > generates a query plan that performs field1=1 condition, and then fie

Re: [SQL] Blank-padding

2005-10-24 Thread Tom Lane
"Shaun Watts" <[EMAIL PROTECTED]> writes: > Is there any way to eliminate the blank padding at the end of character > fields in a table. Use varchar, or text. regards, tom lane ---(end of broadcast)--- TIP 5: don't forget to

Re: [SQL]

2005-10-24 Thread Silke Trissl
Илья Конюхов wrote: >>For example, consider the queres: >> >>SELECT * FROM table1 WHERE field1=1 AND field2=1; >> >>SELECT * FROM table1 WHERE field2=1 AND field1=1; >> >> >>These two queries are logically equivalent. But in all cases the planner >>generates a query plan that performs field1=1 con

Re: [SQL] Problema con migracion de SQL a PostgreSQL

2005-10-24 Thread Cristian Prieto
PostgreSQL si tiene procedimientos almacenados, claro se crean con FUNCTION pero pueden hacer lo mismo que un Stored Procedure en SQL server (con algunas excepciones como retornar varios resultsets diferentes de una vez). SQL Server usa Transac-SQL y PostgreSQL aunque pued

Re: [SQL] query tables based on a query

2005-10-24 Thread Bruno Wolff III
On Fri, Sep 30, 2005 at 18:47:48 -0400, solarsail <[EMAIL PROTECTED]> wrote: > I have a large number of tables with a common naming convention > > basically: > > table001, table002, table003 ... table00n > > > I would like to do a query across all of the tables, however I do not know > all of

[SQL] how to create rule as on delete

2005-10-24 Thread efa din
This is my rule for doing the delete event. The rule can be created. But the problem is, after the record has been deleted from the 'mytable', this record cannot be inserted into table 'maytable_log'. CREATE RULE on_delete AS ON DELETE TO mytable DO INSERT INTO mytable_log values (old.id,old.name)

[SQL] SQL language

2005-10-24 Thread krishnaa sridharan
  Dear all, I am a new user to PostGRE SQL. When i installed the application on the windows xp machine, There were no language for the template database created. Is there a way to add pl/sql to the databse that i create. Can some one guide me on how to do this. Thanks Krishnaa

[SQL] writable joined view

2005-10-24 Thread Sarah Asmaels
Hi! I have one table referencing an object in another table through an ID, and a view joining those tables on the ID. I want to create rules to rewrite updates/deletes/inserts on the joined view to act on the real tables. Can you give me some pointers? The documentation has only examples for views

[SQL] automatic update or insert

2005-10-24 Thread tobbe
Hi. I have a little problem. In a system of mine i need to insert records into table [tbStat], and if the records exist i need to update them instead and increase a column [cQuantity] for every update. I.e. the first insert sets cQuantity to 1, and for every other run cQuantity is increased. Cu

[SQL] Article on Oracle & MySQL in E-week

2005-10-24 Thread Wendell Anderson
You are quite incorrect in stating that MySQL can now claim "parity" with PostgreSQL through it's release of version 5.0. Knowledgeable database experts and administrators who are famiiar with both technologies are aware of "considerable " differences that, at this time still accrue to postgreSQL,

[SQL] Merging lines with NULLs (with example data)

2005-10-24 Thread MaXX
Good afternoon, I have a simple problem, and I feel stupid not finding myself what's the solution... I try to explain shortly, but as I'm not really confident with my explanation, I provided a complete example with data below. How can I "merge" this gday,count_udp,count_tcp '2005-10-20','','2' '

[SQL] SQL Functions

2005-10-24 Thread gurkan
I have been trying to find a way to return more than one but different types of variables. How do I return more than one but mix types of variables. Any help is appriaciated. Thanks; CREATE FUNCTION allMoney_con(integer,integer,date,date) RETURNS AS ' SELECT DISTINCT(inv_acct

Re: [SQL] Sql - Error : Relation tmp_datos already exists

2005-10-24 Thread tobbe
PgAdmin probably encloses all querys in transactions. Do you? If not, try execute "BEGIN" and "COMMIT" just before and after your query.. ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

[SQL] Aggregate versus lineitem report

2005-10-24 Thread Jerry Blumenthal
How do you get a report that lists items and then produces a sum at the end. Like this: name date amount1 amount2 name date amount1 amount2 name date amount1 amount2 totals sum(amount1) sum(amount2) The sql command I am using now is SELECT SUM(Tcode.T_a

[SQL] SQL Functions

2005-10-24 Thread gurkan
I have been trying to find a way to return more than one but different types of variables. How do I return more than one but mix types of variables. Any help is appriaciated. Thanks; CREATE FUNCTION allMoney_con(integer,integer,date,date) RETURNS AS ' SELECT DISTINCT(inv_acct

Re: [SQL] automatic update or insert

2005-10-24 Thread Stewart Ben (RBAU/EQS4) *
> Currently i have implemented this as a stored procedure in the plpgsql > language. This means that in my stored procedure i first do a > select to > find out if the row exists or not, then i do a insert or update > depending if the row existed. > > Unfortunately, stored procedures seems awfull

Re: [SQL] how to create rule as on delete

2005-10-24 Thread Stewart Ben (RBAU/EQS4) *
> If I add the DO INSTEAD,the record can be inserted > into 'maytable_log' and also still remain in the table > 'maytable'. Which is exactly not exist at all. It just > show it as im using the DO INSTEAD. > > My problem is, how to insert the deleted record into > table 'mytable_log' without showin

Re: [SQL] SQL language

2005-10-24 Thread Michael Glaesemann
On Oct 22, 2005, at 0:24 , krishnaa sridharan wrote: I am a new user to PostGRE SQL. Welcome! [Please note that the it is PostgreSQL or Postgres.] When i installed the application on the windows xp machine, There were no language for the template database created. Is there a way to add pl/

Re: [SQL] Article on Oracle & MySQL in E-week

2005-10-24 Thread Michael Glaesemann
On Oct 21, 2005, at 0:38 , Wendell Anderson wrote: You are quite incorrect in stating that MySQL can now claim "parity" with PostgreSQL through it's release of version 5.0. Mr Anderson, Who are you writing to? cegarry(at)yahoo.com? Are you referring to this article? http://www.eweek.co

Re: [SQL] how to create rule as on delete

2005-10-24 Thread elein
I think you want a delete trigger which does your insert and then follows through with the delete by returning old. --elein [EMAIL PROTECTED] On Tue, Oct 18, 2005 at 09:43:34PM -0700, efa din wrote: > This is my rule for doing the delete event. The rule > can be created. But the problem is, after

[SQL] convert timezone to string ...

2005-10-24 Thread Marc G. Fournier
I know that the server knows that ADT == -0400, and AST == -0300 ... is there any way of reversing that? Basically, I want to say: SELECT timezone_str(-0400, 'not dst'); and have it return ADT ... I've got a method of doing it right now, using a function, but just find it looks so messy, ju