Re: [SQL] [SOLVED] Postgres schema comparison.

2005-03-09 Thread Stef
Hi all, If anyone is interested, here's the final solution that I'm using to build a list of tables and their md5sums based on what the psql interface queries when you do '\d [TABLE NAME]' I attached the function I created, and this is the SQL I run : select relname||':'||get_table_checksum(relna

Re: [SQL] order by question

2005-03-09 Thread Greg Stark
Gary Stainburn <[EMAIL PROTECTED]> writes: > > Alternatively: (a<>6),(a<>4),a > > Although this does exactly what I want, at first glance it should do > exactly the opposite. > > I'm guessing that for each line it evaluates > not (a=6) 0 for true else 1 Not really, "not a=6" is an expression t

Re: [SQL] Table like a field

2005-03-09 Thread Richard Huxton
[EMAIL PROTECTED] wrote: Hello. Is there any way to build a table that contain the coluns name for the other table fields? like this: create table people(id serial primary key, name varchar(50) ); create table people_fields ( field_name varchar(30) ); insert into people_fields values ('occupatio

Re: [SQL] order by question

2005-03-09 Thread Bruno Wolff III
On Wed, Mar 09, 2005 at 12:41:55 +, Gary Stainburn <[EMAIL PROTECTED]> wrote: > Hi folks. > > I seem to remember somewhere being shown how to bump specific rows to > the top of a list; something along the lines of: > > select c_id as key, c_des as value from customers order by c_id = 7, >

Re: [SQL] order by question

2005-03-09 Thread Gary Stainburn
On Wednesday 09 March 2005 1:06 pm, you wrote: > Gary Stainburn wrote: > > Hi folks. > > > > I seem to remember somewhere being shown how to bump specific rows > > to the top of a list; something along the lines of: > > > > select c_id as key, c_des as value from customers order by c_id = > > 7, c_

Re: [SQL] interval +variable

2005-03-09 Thread Bruno Wolff III
On Wed, Mar 09, 2005 at 10:58:05 +0200, Fatih Cerit <[EMAIL PROTECTED]> wrote: > Dear all > > Is there anyone at there who knows howto use dateadd in pgsql. I have a > problem in my function that is like this ; > > Select into futuredate now() + interval '30 days'; <- this is ok > but how can

[SQL] Table like a field

2005-03-09 Thread lucas
Hello. Is there any way to build a table that contain the coluns name for the other table fields? like this: create table people(id serial primary key, name varchar(50) ); create table people_fields ( field_name varchar(30) ); insert into people_fields values ('occupation'); insert into people

Re: [SQL] order by question

2005-03-09 Thread Achilleus Mantzios
O Gary Stainburn έγραψε στις Mar 9, 2005 : > Hi folks. > > I seem to remember somewhere being shown how to bump specific rows to > the top of a list; something along the lines of: > > select c_id as key, c_des as value from customers order by c_id = 7, > c_id = 160, value; use the case ... w

Re: [SQL] order by question

2005-03-09 Thread Richard Huxton
Gary Stainburn wrote: Hi folks. I seem to remember somewhere being shown how to bump specific rows to the top of a list; something along the lines of: select c_id as key, c_des as value from customers order by c_id = 7, c_id = 160, value; Looks roughly right. SELECT * FROM foo ORDER BY not(a=6),

[SQL] order by question

2005-03-09 Thread Gary Stainburn
Hi folks. I seem to remember somewhere being shown how to bump specific rows to the top of a list; something along the lines of: select c_id as key, c_des as value from customers order by c_id = 7, c_id = 160, value; however, although the statement is accepted the two rows specified are not b

Re: [SQL] [ADMIN] Postgres schema comparison.

2005-03-09 Thread KÖPFERL Robert
|-Original Message- |From: Goulet, Dick [mailto:[EMAIL PROTECTED] |Sent: Montag, 07. März 2005 16:33 |To: John DeSoi; Stef |Cc: pgsql-ADMIN@postgresql.org; pgsql-sql@postgresql.org |Subject: Re: [SQL] [ADMIN] Postgres schema comparison. | | | My favorite for this task is WinSql available f

Re: [SQL] datestyle setting

2005-03-09 Thread Richard Huxton
Kenneth Gonsalves wrote: On Wednesday 09 Mar 2005 1:40 pm, Richard Huxton wrote: I keep making this mistake, you need to include the database name: ALTER DATABASE my_db_name SET datestyle TO 'ISO'; er ... doesnt seem to be in the docs? Anyway it worked, thanx http://www.postgresql.org/docs/7.4/

Re: [SQL] datestyle setting

2005-03-09 Thread Kenneth Gonsalves
On Wednesday 09 Mar 2005 1:40 pm, Richard Huxton wrote: > > I keep making this mistake, you need to include the database name: >ALTER DATABASE my_db_name SET datestyle TO 'ISO'; er ... doesnt seem to be in the docs? Anyway it worked, thanx -- regards kg http://www.livejournal.com/users/law

Re: [SQL] interval +variable

2005-03-09 Thread Michael Fuhr
On Wed, Mar 09, 2005 at 10:58:05AM +0200, Fatih Cerit wrote: > Is there anyone at there who knows howto use dateadd in pgsql. I have a > problem in my function that is like this ; > > Select into futuredate now() + interval '30 days'; <- this is ok > but how can I use a variable intead of '30 d

[SQL] interval +variable

2005-03-09 Thread Fatih Cerit
Dear all Is there anyone at there who knows howto use dateadd in pgsql. I have a problem in my function that is like this ; Select into futuredate now() + interval '30 days'; <- this is ok but how can I use a variable intead of '30 days':( Thanks ---(end of broadcas

Re: [SQL] datestyle setting

2005-03-09 Thread Richard Huxton
Kenneth Gonsalves wrote: On Wednesday 09 Mar 2005 11:57 am, Tom Lane wrote: If it's a reasonably recent version of PG, either ALTER DATABASE SET or ALTER USER SET might serve. postgresql 7.4. when i type: alter database set datestyle to 'European' i get 'syntax error at or near "datestyle" at char