How to join tables on regex
Say I have two tables msg for messages and mnc for mobile network codes.
They share no relations. But I want to join them
ON array_to_string(regexp_matches(msg.src_addr || ‘+’ || msg.dst_addr, ’38(…)’), ”) = mnc.code
But … Read the rest “How to join tables on regex”
PDO vs pg_* functions
They both have prepared statements.
pg_* is a wrapper to libpq. Right?
I like the PDO in PHP, but I’m not going to change the database in the future.
Which library should I use?
PHP version: 5.4
… Read the rest “PDO vs pg_* functions”
Validation in postgreSQL [closed]
I made an application to collect data from users. Those data will be collected at different places and from these places will be sent to a central server. I need to design a validation plan for the central server in PostgreSQL. Data must be checked against … Read the rest “Validation in postgreSQL [closed]”
How to provide a password for PostgreSQL’s createdb non-interactively?
I have a task in phing where before tests I drop the database if exists and create it. This is run on Jenkins.
I want to do it with createdb like this:
The thing is that the createdb is asking me … Read the rest “How to provide a password for PostgreSQL’s createdb non-interactively?”
PostgreSQL query taking too long
I have database with few hundred millions of rows. I’m running the following query:
select * from “Payments” as p
inner join “PaymentOrders” as po
on po.”Id” = p.”PaymentOrderId”
inner join “Users” as u
On u.”Id” = po.”UserId”
INNER JOIN “Roles” as r
on u.”RoleId” … Read the rest “PostgreSQL query taking too long”
More efficient way of doing destroy_all in Rails?
Is there a quicker way of doing destroy all in rails?
I’m asking this because rails does an individual delete sql query per record.
For example calling destroy all on a search for 4 records would then run 4 delete sql commands.… Read the rest “More efficient way of doing destroy_all in Rails?”
Connect to remote postgresql server on amazon ec2
I started an amazon ec2 instance, and installed postgresql 9.1 over it. I then went to the
Security Group: quicklaunch-1(there was one moredefault` which i did not change) and opened the 5432 TCP Port, the table looks like this:
(Service) Source Action… Read the rest “Connect to remote postgresql server on amazon ec2”
Can NLTK be used in a Postgres Python Stored Procedure
Has anyone done or even no if its possible to use NLTK within a Postgres Python Stored Procedure or trigger
You can use pretty much any Python library in a PL/Python stored procedure or trigger.
… Read the rest “Can NLTK be used in a Postgres Python Stored Procedure”
Wildcard search in postgresql
In postgresql, I have mangaged to add wildcard pattern (*) to the query using SIMILAR TO option. So my query will be,
SELECT * FROM table WHERE columnName SIMILAR TO ‘R*’
This query would return all entities starting from ‘R’ and not ‘r’. I want to … Read the rest “Wildcard search in postgresql”
How to migrate complex Rails database to use UUID primary keys Postgresql
I have a database I would like to convert to use UUID’s as the primary key in postgresql.
I have roughly 30 tables with deep multi-level associations. Is there an ‘easy’ way to convert all current ID’s to … Read the rest “How to migrate complex Rails database to use UUID primary keys Postgresql”