Re: [SQL] Quotes and spaces

2001-10-05 Thread Oleg Lebedev
I just upgraded to 7.1 and the query works for me now. thanks, Oleg Stephan Szabo wrote: > On Fri, 5 Oct 2001, Oleg Lebedev wrote: > > > Hi, > > I looked through PL/pgSQL tutorial, but I can't get quotes and spaces to > > work in queries executed from Pl/pgSQl. Here is an example: > > > > creat

Re: [SQL] Quotes and spaces

2001-10-05 Thread Stephan Szabo
On Fri, 5 Oct 2001, Oleg Lebedev wrote: > Hi, > I looked through PL/pgSQL tutorial, but I can't get quotes and spaces to > work in queries executed from Pl/pgSQl. Here is an example: > > create procedure get_name(varchar) > ... > BEGIN > query := ''SELECT first_name || || last_name

Re: [SQL] Quotes and spaces

2001-10-05 Thread Josh Berkus
Oleg, I'm assuming that this is just a hypothetical example, as the below is far from the fastest way to get something as simple as a name. > BEGIN > query := ''SELECT first_name || || last_name FROM > user''; > EXECUTE query; > ... > END; > ... I'm pretty sure your quotes are

[SQL] Quotes and spaces

2001-10-05 Thread Oleg Lebedev
Hi, I looked through PL/pgSQL tutorial, but I can't get quotes and spaces to work in queries executed from Pl/pgSQl. Here is an example: create procedure get_name(varchar) ... BEGIN query := ''SELECT first_name || || last_name FROM user''; EXECUTE query; ... END; ... Basically

Re: [SQL] SQL CONSTRAINTS - Constraining time values from two

2001-10-05 Thread Peter Eisentraut
Maher, Christopher W writes: > I was looking for a solution on how to write a constraint into a ' create > table ' expression that would ensure that one ' TIME ' attribute value > called arrival_time (declared as TIME) is allways constrained to have a > value that ensures it is allways after anot

Re: [SQL] temporary views

2001-10-05 Thread Alex Pilosov
On Fri, 5 Oct 2001, Bruce Momjian wrote: > > What actually should happen is that the view should go away at the end > of the session. However, unlike indexes, we can have several tables > involved in a view so it is hard to know exactly how to handle this. > > Seems like a TODO item, at least.

Re: [SQL] temporary views

2001-10-05 Thread Bruce Momjian
> Bruce Momjian wrote: > > > > > Hi > > > I have simple question: How to create view on a temporary table? > > > I need this, because pl/pgsql function returns data via temporary table. > > > > > > View created on a temporary table is useful only to the end of session. > > > Next time i create th

Re: [SQL] SQL CONSTRAINTS - Constraining time values from two attributes on a table.

2001-10-05 Thread Josh Berkus
Chris, > Hi, > I was looking for a solution on how to write a constraint into a ' > create > table ' expression that would ensure that one ' TIME ' attribute > value > called arrival_time (declared as TIME) is allways constrained to have > a > value that ensures it is allways after another attrib

Re: [SQL] temporary views

2001-10-05 Thread Tomasz Myrta
Bruce Momjian wrote: > > > Hi > > I have simple question: How to create view on a temporary table? > > I need this, because pl/pgsql function returns data via temporary table. > > > > View created on a temporary table is useful only to the end of session. > > Next time i create the same temp tabl

[SQL] sql + C

2001-10-05 Thread Esteban Gutierrez Abarzua
hi. who knows about C embebed (postgres + C)? I have the program: #include EXEC SQL BEGIN DECLARE SECTION; VARCHAR base[50]; EXEC SQL END DECLARE SECTION; EXEC SQL INCLUDE sqlca; EXEC SQL DECLARE C77 CURSOR FOR select datname from pg_user,pg_database where usename= :user and datdba=use

Re: [SQL] Why the weak key is created as unique

2001-10-05 Thread Stephan Szabo
You probably do not want a serial in BBB since you want to be setting the values. Use "a int references AAA" instead I think. ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

[SQL] Why the weak key is created as unique

2001-10-05 Thread Marat Khairullin
Example: mydb=> create table AAA (a serial primary key); NOTICE: CREATE TABLE will create implicit sequence 'aaa_a_seq' for SERIAL column 'aaa.a' NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'aaa_pkey' for table 'aaa' CREATE mydb=> create table BBB (a serial references AAA, b i

[SQL] Why the weak key is created as unique

2001-10-05 Thread Marat Khairullin
mydb=> create table AAA (a serial primary key); NOTICE: CREATE TABLE will create implicit sequence 'aaa_a_seq' for SERIAL column 'aaa.a' NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'aaa_pkey' for table 'aaa' CREATE mydb=> create table BBB (a serial references AAA, b integer, pr

Re: [SQL] Simple Query HELP!!!

2001-10-05 Thread Paolo Colonnello
[EMAIL PROTECTED] (--CELKO--) wrote in message news:<[EMAIL PROTECTED]>... > Please write DDL and not narrative. here is my guess at what you are > trying to do. What you posted was not a table because you had no key. > TEXT is not the datatype to use for names -- unless they are thousand > of

[SQL] COPY COMMAND -- Hanging

2001-10-05 Thread Bhuvan A
hi all, i am facing a strange problem in using COPY COMMAND. As i would like to merge 2 databases, i dumped data from one by $ pg_dump -R bhuvan -f bhuvan.sql Here i found data dumped using COPY COMMAND. now i tried to restore few of the tables. so i copied those tables alone to seperate file

Re: [SQL] challenging query

2001-10-05 Thread Haller Christoph
> > Consider the following table: > > A B C D select? > --- > 1 FOO A1 100 n > 1 BAR Z2 100 n > 2 FOO A1 101 y > 2 BAR Z2 101 y > 3 FOO A1 102 y > 4 BAR

[SQL] getting OID from PL/PgSQL AFTER trigger

2001-10-05 Thread Vladimir Vukicevic
Howdy, I'm trying to get the OID of the NEW/OLD rows in an AFTER trigger implemented in PL/PgSQL. Unfortunately, those end up as records in the trigger, and I can't just use NEW.oid. Is there any way to do this? I could do it using a trigger written in C, but I'd rather not have to carry arou

Re: [SQL] ORDER BY case insensitive?

2001-10-05 Thread Bob Swerdlow
Thanks for the suggestion, Jason. A co-worker of mine, however, had this response: Yes, but my guess is that that will first convert all million (or whatever) records to upper case, and then physically sort them. It won't be able to make use of the index. To make this efficient, do we need

[SQL] SQL CONSTRAINTS - Constraining time values from two attributes on a table.

2001-10-05 Thread Maher, Christopher W
Hi, I was looking for a solution on how to write a constraint into a ' create table ' expression that would ensure that one ' TIME ' attribute value called arrival_time (declared as TIME) is allways constrained to have a value that ensures it is allways after another attribute value called departu

[SQL] COPY COMMAND -- Hanging

2001-10-05 Thread Bhuvan A
hi all, i am facing a strange problem in using COPY COMMAND. As i would like to merge 2 databases, i dumped data from one by $ pg_dump -R bhuvan -f bhuvan.sql Here i found data dumped using COPY COMMAND. now i tried to restore few of the tables. so i copied those tables alone to seperate file

[SQL] SQL-Programmer tool and field%type support

2001-10-05 Thread Mourad EL HADJ MIMOUNE
Hi, I'm looking for PL/SQL programmer tool. I wanted to use SQL-Programmer but it doesn't support Postgres data base. Please can sommeone suggest me an other tool wich can replace this one or explaine me how we can use SQLProgrammer with Postgres if it is possible. I have an other question ab

Re: [SQL] Problem with n to n relation

2001-10-05 Thread Morgan Curley
just get rid of the serial_id in person2adress -- there is no reason for it. Make the pk of that table a composite --> person_id, address_id <-- that way you have added some additional integrity to your structure. Only one record can exist ffor a given person at a given address. However any pers

[SQL] Problem with n to n relation

2001-10-05 Thread Janning Vygen
Hi, i create n to n relations like this, right? create table person ( idserial, name text ); create table address ( id serial, street text ... ); create table person2adress ( id serial, person_id integer not null references person(id), address_id integer not n

Re: [SQL] challenging query

2001-10-05 Thread Haller Christoph
> > Consider the following table: > > A B C D select? > --- > 1 FOO A1 100 n > 1 BAR Z2 100 n > 2 FOO A1 101 y > 2 BAR Z2 101 y > 3 FOO A1 102 y > 4 BAR