Uwe said:
how about using 2 tables with according unique/primary key constraints and a
view to actually access the data (mixing the 2 tables into one) ?
Oliver said:
Create a separate table with the two columns name and isbn which are
that table's primary key; on the main table, create a
I would create a multi-column unique index on the table. This should solve
the problem mentioned although you may still have an integrity issue if a
book name is mistyped.
Hm?
This sounds promising, except it's the exact opposite of what I need.
Is this what you meant?
CREATE TABLE
;
END IF;
RETURN NEW;
END;
$function$ LANGUAGE plpgsql;
CREATE TRIGGER ndi BEFORE INSERT OR UPDATE ON books FOR EACH ROW
EXECUTE PROCEDURE non_duplicated_isbn();
On 10/8/05, Miles Keaton [EMAIL PROTECTED] wrote:
I'm stuck on a brain-teaser with CONSTRAINT:
Imagine a table like lineitems
possible bug :
pg_dump does not include ALTER DATABASE ... SET search_path TO ...
pg_dumpall does include it.
pg_dump only includes the runtime SET search_path, but not the permanent ALTER DATABASE part
is this intentional?
I'm stuck on a brain-teaser with CONSTRAINT:
Imagine a table like lineitems in a bookstore - where you don't need
an ISBN to be unique because a book will be in buying history more
than once.
But you DO need to make sure that the ISBN number is ONLY matched to
one book name - NOT to more than
I have the contrib/pgcrypto installed.
I want to get the 40-character hash from SHA1
Example: SELECT digest('blue', 'sha1') would be:
4c9a82ce72ca2519f38d0af0abbb4cecb9fceca9
I was surprised and disappointed to get a binary-hash back.
Does anyone know how to get the regular 40-character string
I've made a PL/pgSQL function to validate UPC and EAN barcodes.
It works correctly, but is a little ugly.
Wondering if any PL/pgSQL experts can offer some suggestions. (I'm
new to PL/pgSQL.)
Main questions:
#1 - I wanted to add a 0 to the front of the barcode if it was only
12 characters long.
Slashdot story just posted a few minutes ago:
http://slashdot.org/article.pl?sid=05/03/21/1635210
I've been using PostgreSQL for years on small projects, and I have an
opportunity to migrate my company's websites from Oracle to an
open-source alternative. It would be good to be able to show the
use --disable-triggers
Hey! Cool. Worked. Thanks!
---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
When I do a pg_dump, (--data-only), PG7 used to dump the data out in
order, so that all foreign-key checks worked correctly when loading
the data back in.
Now it seems with PG8 it's dumping it completely out of order (one of
my completely foreign-key join tables first!) - and I can't get it to
Is it possible for a query to delete a record and all of its
foreign-key dependents?
I see DROP CASCADE, but not a DELETE CASCADE.
What I'm trying to do:
I have a clients table.
I have many different tables that use the clients.id as a foreign key.
When I delete a client, I want it to delete all
On Thu, 30 Dec 2004 11:10:38 -0800, I wrote:
Is it possible for a query to delete a record and all of its
foreign-key dependents?
Sorry - to be more clear : I like having my foreign keys RESTRICT from
this kind of cascading happening automatically or accidently.
So I'm looking for a query
Cool. Thanks for all the advice, guys.
I'll just keep my script manually deleting dependencies, then. It
gives me peace of mind.
:-)
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster
I'm posting this here for search-engine's sake, so future people
having this same problem can find the solution here.
After installing PostgreSQL from FreeBSD's ports, and running su -
pgsql -c initdb for the first time, I got this common error:
could not create semaphores : No space left on
I just noticed PostgreSQL's schemas for my first time.
(http://www.postgresql.org/docs/current/static/ddl-schemas.html)
I Googled around, but couldn't find any articles describing WHY or
WHEN to use schemas in database design.
Since the manual says HOW, could anyone here who has used schemas
Is there a simple way to list fieldnames in a table, from PHP?
When on the command-line, I just do \d tablename
But how to get the fieldnames from PHP commands?
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an
Here's an interesting problem!
When a sequence clashes with data already in that table:
CREATE TABLE clients (
id serial NOT NULL PRIMARY KEY UNIQUE,
name varchar(64));
-- import OLD clients, with their original ID#...
INSERT INTO clients VALUES (3, 'Dave');
INSERT INTO clients VALUES (4,
PG peeps:
What's the prevailing wisdom best-practice advice about when to let
a varchar (or any) column be NULL, and when to make it NOT NULL
DEFAULT '' (or '-00-00' or whatever) - in PostgreSQL?
{Moving to PG from MySQL where we were always advised to use NOT NULL
to save a byte or
still doing my switch from MySQL to PgSQL, and can't figure out what
the comparable function would be for this:
In MySQL, to store a big secret (like a credit card number) in the
database that I didn't want anyone to be able to see without knowing
the salt/password value, I would do this into a
I'm switching to PostgreSQL from MySQL. Using the SAMs book called
PostgreSQL which has been great to skim the surface of the
differerences.
I had never even heard of things like triggers, views, and foreign keys before.
Any recommended books or websites (or exercises) that would really
help
I'm a brand new PostgreSQL user -- just started today (though I've
used MySQL for years).
Should I just start learning with version 8, since I'm sure I won't
launch any real live public projects with PostgreSQL for another few
months?
Any estimate when 8.0.0 will be final production-ready?
21 matches
Mail list logo