>
> 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
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
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
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
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
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
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
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
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
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
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
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
> 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
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.
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
[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
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
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
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
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
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
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
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
>
> 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
24 matches
Mail list logo