GRESQL!
--
W. Matthew Wilson
m...@tplus1.com
http://tplus1.com
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
On Sun, Aug 24, 2014 at 2:50 PM, Daniele Varrazzo
wrote:
> It should be added to the library (it was first discussed in 2003...),
> but it's one of these things that will stop working when psycopg will
> start using the "extended query protocol" (together with other nifty
> features such as string
I still don't want to break my "no string interpolation"
rule of thumb unless I absolutely have to.
And I know I could switch to some gigantic library like SQLAlchemy,
but I really don't want to.
Any advice is welcome. Thanks in advance!
Matt
--
W. Matthew Wilson
ols.product(*[['north', 'south'], ['retail',
'manufacturing', 'wholesale']]))
[('north', 'retail'),
('north', 'manufacturing'),
('north', 'wholesale'),
('south', 'retail'),
('south', 'manufacturing'),
('south', 'wholesale')]
All advice is welcome. Thanks in advance!
Matt
--
W. Matthew Wilson
m...@tplus1.com
http://tplus1.com
I want to run a query like to_tsquery("A | B | C") and then rank the
results so that if a document contained A, B, and C, then it would
rank above a document that just had some subset.
How would I do such a thing?
--
W. Matthew Wilson
m...@tplus1.com
http://tplus1.com
--
Sent
search. Is it possible?
I understand that I can do a query and rank the results by how closely
the words are to each other, but I want to exclude any matches where
the words are not within two words of each other.
Thanks in advance!
Matt
--
W. Matthew Wilson
m...@tplus1.com
http://tplus1.
re both able to
make their own temporary tables.
More generally, how to tame this big ol' query?
The temporary tables mean I'm only pulling data from the database one
time. ORMs often pull data from one query and then use that data to
write the next query. This seems slow to me.
Matt
--
I have a table like this:
create table event(
destination_id integer not null references destination
(destination_id),
starts timestamp,
ends timestamp
);
I want to make sure that no two rows **with the same destination_id**
overlap in time.
I'm not sure how to write this exclu
On Mon Aug 16 10:26:36 2010, Tom Lane wrote:
> Matthew Wilson writes:
>> All I can come up with so far is to use a view and then another view on
>> top of that one:
>
> Note that you don't actually need a view, as you can just write the
> subselect in-line:
>
&g
I'm converting some procedural code to SQL as an experiment. Here's the
pseudocode:
c = a - b
if c < 0 then d = 'no'
else d = 'yes'
In SQL, I've got this:
select a, b, a - b as c,
case when a - b < 0 then 'no'
else 'yes'
end as d
from foo;
This is a trivial exa
I have a daily job that pushes data from the production database into
the reporting database, which right now, is an exact copy.
I have a webapp that builds lots of reports for users. Most of these
reports involve elaborate joins of lookup tables and lots of summations,
and they take too long to
Just recently I discovered the listen/notify feature in postgresql.
Now I don't have external processes polling tables, watching for new
inserted rows.
Anyhow, I'm curious if there is some other feature that will help me out
with a new puzzle.
I want to store emails to deliver at a later time in
I have a table shift with a start_time column and a stop_time column and
I do a lot of queries like:
select * from shift
where (start_time, stop_time) overlaps ($A, $B);
$A and $B are user-submitted values.
Anyhow, how do I put indexes on my table to make these queries run
faster?
Also,
I track employee qualifications in one table and I track job
requirements in another table. A job requires zero-to-many
qualifications, and for an employee to be qualified for that job, the
employee must have ALL the requirements.
For example, In my job requirements table, I record that a nurse m
Jeff, this is *exactly* the kind of feedback I was hoping to get.
Thanks so much for the link and the explanation.
Matt
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
I need to track employees and their preferred locations, shifts, and
stations.
For example, I need to track that Alice prefers to work the morning
shift at the west-side location, and she likes to work the cash-register
station.
Also, I need to track that Bob likes the west-side and north-side
lo
I'm trying to comprehend how NULL values interact with unique indexes.
It seems like I can insert two rows with NULL values in a column with a
unique constraint just fine.
Is there something special about NULL? Can anyone post some links to
explain what is going on?
Here's the example that stump
On Tue 02 Sep 2008 05:35:25 PM EDT, D. Dante Lorenso wrote:
> You could add a trigger to your product_location table that just
> double-checked the customers matched or prevents the insert/update. A
> PL/PGSQL function like this might help:
>
> -- 8< 8< --
>
On Tue 02 Sep 2008 04:40:55 PM EDT, Scott Marlowe wrote:
> On Tue, Sep 2, 2008 at 2:35 PM, Matthew Wilson <[EMAIL PROTECTED]> wrote:
>> On Tue 02 Sep 2008 04:19:41 PM EDT, Scott Marlowe wrote:
>>> If the two subordinate tables ALWAYS have to point to the same place,
>
On Tue 02 Sep 2008 04:19:41 PM EDT, Scott Marlowe wrote:
> If the two subordinate tables ALWAYS have to point to the same place,
> why two tables? Can't a customer have > 1 location? I'm pretty sure
> IBM has more than one corporate office you could ship things to.
Yeah, so the idea is one custo
On Tue 02 Sep 2008 04:06:20 PM EDT, Martin Gainty wrote:
> you can use setup a foreign key constraint in your create table so that col=
> umn is only populated when
> there is a value which syncs to the referenced value
> http://www.postgresql.org/docs/7.4/interactive/sql-createtable.html
I don't
I'm building an app that has a customers table, a locations table, a
products table, and a product_locations table.
They make a diamond shape.
The locations table and the products table each have a customer_id
column that links back to the customers table.
Then the product_locations table table
I have table sort of like this:
create table snoz (
a bool default false,
b bool default false,
c bool default false
);
I want to set up a trigger so that any time a row is inserted or
updated, the value of c is set to true if a and/or b is true.
How can I do this?
Thanks!
Matt
-
I'm building a shift-scheduling app. I want to make a constraint in my
database that prevents one human from being assigned to work two
different jobs at the same time.
In other words, if I schedule John Doe to mop bathrooms from 10 AM until
4 PM, some other manager will not be able to schedule J
I have an employees table and one column in the employees table is
"supervisor_id" which is an FK to the id column.
I have employees from numerous companies all in the same table. I have
a column called company_id that indicates the company.
I want to make sure that an employee chooses a super
On Wed 02 Jan 2008 04:23:46 AM EST, Pavel Stehule wrote:
> Hello
>
> IDEA 3:
>
> Use two hash functions:
>
> CREATE UNIQUE INDEX uidx ON TEST((decode(md5(a),'hex')),(hashtext(a)));
>
> removing spaces helps
> CREATE UNIQUE INDEX uidx ON test((decode(md5(lower(replace(a,'
> ',''))),'hex')));
>
> Re
I have a table MESSAGE with a text column and a timestamp column. I
want to make sure that I have no rows with duplicates for both values.
I have two ideas right now for how to do this.
IDEA 1:
CREATE UNIQUE INDEX nodups on MESSAGE (my_timestamp_col, my_text_col);
IDEA 2:
CREATE UNIQUE INDEX n
I have a lot of code -- millions of lines at this point, written
over the last 5 years. Everything is in a bunch of nested folders.
At least once a week, I want to find some code that uses a few modules,
so I have to launch a find + grep at the top of the tree and then wait
for it to finish.
I w
I have been using postgresql for my web application for a while now and
it has been great.
I want to set up a separate emergency failover server and database in a
different data center.
In the event that my primary data center becomes inaccessible, I want to
update a DNS record and then redirect
29 matches
Mail list logo