[SQL] Copy from a SELECT

2003-02-26 Thread val
I know that the COPY command requires that you work with plain 
tables.

Is there any other way at all of export only part of a table

---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


[SQL] disable constraints

2003-02-26 Thread rute solipa
hello,

does anyone nows how can i disable/enable table or column constraints?

in oracle it's possible to disable constraints like this:

alter table tb_1
disable primary key;
best regards,
rute
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly


Re: [SQL] disable constraints

2003-02-26 Thread rute solipa
i whant avoid to dropping constraint, i whant to disable the constraints, 
because i need to insert a large amont of data.
is there a way?

best regards,
rute


At 03:47 PM 2/26/2003 +0100, you wrote:
Hi!

use "alter table ??? drop constraint ???"

example:

create table asdf (userid text, foreign key (userid) references 
person(userid) on delete cascade);

\d asdf
Table "public.asdf"
 Column | Type | Modifiers
+--+---
 userid | text |
Foreign Key constraints: $1 FOREIGN KEY (userid) REFERENCES person(userid) 
ON UPDATE NO ACTION ON DELETE CASCADE

alter table asdf drop constraint "$1";

Regards,
Patrik Kudo
rute solipa wrote:
hello,
does anyone nows how can i disable/enable table or column constraints?
in oracle it's possible to disable constraints like this:
alter table tb_1
disable primary key;
best regards,
rute
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



---(end of broadcast)---
TIP 6: Have you searched our list archives?
http://archives.postgresql.org


Re: [SQL] Relation "pg_relcheck"

2003-02-26 Thread Tilo Schwarz
Tom Lane writes:
> "Victor Yegorov" <[EMAIL PROTECTED]> writes:
> > mema2=> \d forest
> > ERROR:  Relation "pg_relcheck" does not exist
> >
> > Whats the problem, I wonder.
>
> psql version not matching server version.
>
>   regards, tom lane

Because this sort of questions appears quite often, I was wondering, if the 
start up message of psql could be changed from 


Welcome to psql 7.4devel, the PostgreSQL interactive terminal.


to something like


Welcome to psql 7.4devel, the PostgreSQL interactive terminal.
Connected to PostgreSQL .


to make it easier to catch these errors. Don't I get the server version with 
"select version();"? (I would even try my first patch if folks would like 
it...)

Best regards,

Tilo

---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


Re: [SQL] Return type of triger functions from OPAQUE to TRIGGER in 7.3

2003-02-26 Thread Josh Berkus
Roberto,

> No, that was not what I was suggesting. I was suggesting (based on my
> assumption that 'create function ... returns opaque' would convert the
> return type to trigger), that its behaviour be made consistent with
> 'create or replace function' and throw an error if the type is opaque.

I can't see any way to do that without making it very difficult to upgrade to 
7.3.

> For our next release, our plan was to have both 7.2 and 7.3
> compatibility. For the release after that, 7.2 compatibility would
> probably be dumped in favor of 7.3, where we could make use of 7.3-specific
> features. We wanted it to be a gradual path.

Where does OpenACS do its object creation?  Just at setup/install time, or 
through the life of the program?   If the former, I'd suggest having two 
seperate database install scripts ... one for 7.2.and one for 7.3.

-- 
Josh Berkus
Aglio Database Solutions
San Francisco

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly


Re: [SQL] disable constraints

2003-02-26 Thread Patrik Kudo
Hi!

use "alter table ??? drop constraint ???"

example:

create table asdf (userid text, foreign key (userid) references 
person(userid) on delete cascade);

\d asdf
Table "public.asdf"
 Column | Type | Modifiers
+--+---
 userid | text |
Foreign Key constraints: $1 FOREIGN KEY (userid) REFERENCES 
person(userid) ON UPDATE NO ACTION ON DELETE CASCADE

alter table asdf drop constraint "$1";

Regards,
Patrik Kudo
rute solipa wrote:
hello,

does anyone nows how can i disable/enable table or column constraints?

in oracle it's possible to disable constraints like this:

alter table tb_1
disable primary key;
best regards,
rute
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly


---(end of broadcast)---
TIP 6: Have you searched our list archives?
http://archives.postgresql.org


Re: [SQL] Design Q.:logic in app or db?

2003-02-26 Thread Josh Berkus
George,

> I have general design question about Postgres usage:  How does one decide
> how much, and what parts of logic should go in DB rules, triggers,
> functions, constraints etc, versus what should go in the application?

Ideally, this should be done strictly on the basis of carefully planned design 
architecture, where each business rule is implemented at the application 
level where it is most effective, such as referential data integrity in the 
database and security in the middleware.

Realistically, business logic tends to be implemented in the layer where you 
have the most programming expertise.   The people on this list are often 
expert DBAs, so they implement as much business logic as possible in the 
database in the form of views, triggers, and rules.   However, I"ve seen 
plenty of shops with multiple crackerjack Java programmers and a weak DBA 
implementing all of their business logic in the middleware.  

> The main thing not done yet is to facilitate ad-hoc queries
> (via odbc excel etc.) from db-naive users:  maybe restructuring the
> db to make it simpler, maybe views and functions... The data is
> somewhat complex in structure.

This desired feature would argue strongly in favor of putting as much business 
logic as possibly in your database in the form of views and rules.   If users 
can bypass the interface and middleware, you cannot rely on it to enforce 
data integrity and access control.

-- 
Josh Berkus
[EMAIL PROTECTED]
Aglio Database Solutions
San Francisco

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


[SQL] btree_gist, gint4_union

2003-02-26 Thread Itai Zukerman
In contrib/btree_gist/ I see:

  CREATE FUNCTION gint4_union(bytea, internal)
  RETURNS int4
  AS 'MODULE_PATHNAME'
  LANGUAGE 'C';

but gint4_union does this:

  INT4KEY *out = palloc(sizeof(INT4KEY));
  [...]
  PG_RETURN_POINTER(out);

Is the int4 return type declared above a bug?

-- 
Itai Zukerman  

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


[SQL] Design Q.:logic in app or db?

2003-02-26 Thread george young
I have general design question about Postgres usage:  How does one decide
how much, and what parts of logic should go in DB rules, triggers,
functions, constraints etc, versus what should go in the application? 

I see postings here from people who obviously have a lot of domain
logic in the DB side.  I currently have almost none.  I plan to set up
a bunch of RI constraints to keep things clean and consistant, but what
about logic that implements frequent domain operations?

Brief sketch of my project: 2 developers, 4k lines of python(gtk, pygres),
2 main GUI user apps and a few read-only scripts for web display, 
50 concurrent users(all local), DB performance important but not currently
a problem.

The main thing not done yet is to facilitate ad-hoc queries 
(via odbc excel etc.) from db-naive users:  maybe restructuring the
db to make it simpler, maybe views and functions... The data is
somewhat complex in structure.

-- George
-- 
 I cannot think why the whole bed of the ocean is
 not one solid mass of oysters, so prolific they seem. Ah,
 I am wandering! Strange how the brain controls the brain!
-- Sherlock Holmes in "The Dying Detective"

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster