[SQL] Table constraints and INSERT

2006-05-17 Thread Risto Tamme
Hello I use PostgreSQL in my program and I found a strange behavior, at least for me. I have a simple table with constraint CREATE TABLE PART ( P_PARTKEY int4 NOT NULL, P_RETAILPRICE numeric, CONSTRAINT PART_PRIMARY PRIMARY KEY (P_PARTKEY), CONSTRAINT PART_check CHECK (P_RETAILPRICE =

[SQL] Database OID

2006-05-17 Thread Kis János Tamás
Hi, How can I find the database OID from simple SQL command? Thanks, kjt McAfee SCM 4.1 által ellenőrizve! ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Table constraints and INSERT

2006-05-17 Thread Niklas Johansson
On 17 maj 2006, at 08.42, Risto Tamme wrote: INSERT INTO PART (P_PARTKEY,P_RETAILPRICE) VALUES(999,90109.89); but it fails: ERROR: new row for relation PART violates check constraint PART_check The P_PARTKEY column is an integer, which means the expression P_PARTKEY/10 will yield 99,

Re: [SQL] Recursive SELECT problem

2006-05-17 Thread Tom Lane
Dave Page dpage@vale-housing.co.uk writes: I'm trying to write a query to determine whether or not the current login role has CREATEDB (or CREATEROLE) privileges, either directly or inherited from a parent role. Those privileges don't inherit, so I'm not sure why you need a recursive check.

Re: [SQL] Recursive SELECT problem

2006-05-17 Thread Dave Page
-Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: 17 May 2006 15:07 To: Dave Page Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Recursive SELECT problem Dave Page dpage@vale-housing.co.uk writes: I'm trying to write a query to determine whether or not the

[SQL] MySQL DB to PostgresSQL DB

2006-05-17 Thread Jose Apablaza
Dear all, This is my first post and I will try to be short and clear in my questions and I hope you can help me with that. I have a MySQL DB and I want to export to PostgreSQL DB. My questions are; - Is posible to export MySQL DB to PostgreSQL DB? - Does PostgreSQL DB has tools to import MySQL DB?

[SQL] how referencing %rowtype variables without column names

2006-05-17 Thread lingyu . tseng
I wrote a trigger and use %rowtype , the problue is I need to put the column name in a variable like Declare columnname VARCHAR(20); NOTIFYRULE NOTIFY_RULE%ROWTYPE begin columnname='TYPE' /* ONE OF NOTIFY_RULE column*/ SELECT * INTO NOTIFYRULE FROM NOTIFY_RULE WHERE STATUS=:OLD.STATUS; end;

Re: [SQL] [pgsql-www] MySQL DB to PostgresSQL DB

2006-05-17 Thread Jeff MacDonald
greetings, I don't know if pgsql-www is the right place for your questions or not, but I'll be nice and give you a few ideas on how to get your questions answered.. :) On Tue, 2006-05-16 at 00:19 +0200, Jose Apablaza wrote: Dear all, This is my first post and I will try to be short and

[SQL] table constraint + INSERT

2006-05-17 Thread Risto Tamme
Title: table constraint + INSERT Hello I use PostgreSQL in my program and I found a strange behavior, at least for me. I have a simple table with constraint CREATE TABLE PART ( P_PARTKEY int4 NOT NULL, P_RETAILPRICE numeric, CONSTRAINT PART_PRIMARY PRIMARY KEY (P_PARTKEY), CONSTRAINT