Tagged Questions
0
votes
3answers
23 views
converting mysql scripts to postgresql script
I have the following line in a .sql file from a mysql db:
ALTER TABLE lcr_gw ALTER COLUMN ip_addr TYPE VARCHAR(50) DEFAULT NULL;
I would like to convert it into syntax that postgresql would ...
0
votes
3answers
49 views
How do databases maintain results if another query edits those results
I was just wondering how most relational databases handled maintaining your set of results if another query has edited those rows that you were working on. For instance if I do a select of like 100k ...
1
vote
1answer
29 views
Converting MySQL “get top y for each n” GROUP BY query to PostgreSQL
Ok so I'm going from mysql to postgresql because of Heroku. I have this statement that works perfect in mysql, but I can't seem to figure out the best way / any way for PG.
m = C.select("m.derp, ...
0
votes
0answers
17 views
Promote staging database to be new production database in a Rails application
How can I create a feature where data changes in a staging environment, after QA, could be "promoted" to production? My expectation is that the code base would be the same in both environments and ...
0
votes
3answers
50 views
SQL, build a query using data provided in the query itself
For experimental purposes only.
I would like to build a query but not querying data extracted for any table but querying data provided in the query it self. Like:
select numbers.* from (1, 2, 3) as ...
0
votes
1answer
18 views
Geolocation queries in Doctrine2
I am using Doctrine2 and CodeIgniter2 for my test application. I have a table in my database that stores all the geographic locations have fields
Name
Latitude
Longitude
Created(Timestamp)
I see ...
0
votes
1answer
12 views
Django Postgres Aggregate Functions
I want to use aggregate functions on a column in my model.
Following is my model:-
class ShipmentWeightMapping(models.Model):
weight = models.CharField(max_length = 255)
status = ...
0
votes
3answers
51 views
Use table alias in another query to traverse a tree
I have the following query:
select * from (
select p1.c as child, p1.p as parent, 1 as height
from parent as p1
where (p1.c=3 or p1.c=8);
union
select p2.c as child, p2.c as parent, ...
1
vote
1answer
26 views
Database connection pooling for R parallel process [duplicate]
I have a database connection to PostgreSQL using the package RPostgreSQL. Currently I do the following:
retrieve a list from my database
run the list through a for loop, doing a calculation and ...
2
votes
2answers
42 views
SQL query using outer join and limiting child records for each parent
I'm having trouble figuring out how to structure a SQL query. Let's say we have a User table and a Pet table. Each user can have many pets and Pet has a breed column.
User:
id | name
...
-4
votes
0answers
13 views
how to connect android to postgresql database?
i want to connect my application android to postgresql database, with web services php, when i execute my php file i get the result, but when i try to connect from my application i got the message ( ...
0
votes
0answers
10 views
Rails: Query and joins on postgres schemas
Using postgresql schema's pretty heavily and want to convert many of my previously sql written queries to ActiveRecord query.
Firstly, how would I convert a query like this to AR:
def language
...
-1
votes
0answers
19 views
How to migrate from pgsql in production environment
I have developed an rails application using mysql as a database. how should i deploy this application to heroku without modifying my development environment ?
-1
votes
0answers
17 views
How to store information in my particular case? [closed]
I have a question which descision may help me to understand more about DB and gives me more experience!
So, for example, I need to store the information about presentations made by users. They can ...
1
vote
1answer
22 views
Find polygons that fall within a latitude/longitude combination with a N margin in degrees in MySQL/PostgreSQL
Normally to find polygons that compasses a certain GPS point you can use a query like:
SELECT * FROM `polygons` WHERE ST_CONTAINS(`polygon`, POINT(-33.874087, 151.207865)));
However how you go with ...
2
votes
2answers
81 views
how does oracle makes 1 million insertion in 1 second
Few years ago, I found oracle can achieve 1 million insertion in 1 second, first let me explain this, I remember in SQL/PLUS interactive command line
set timing on
create table tbl as
select ROWNUM ...
1
vote
1answer
20 views
Rails + Postgres Relation Issue With Custom Foreign Key
I'm in the middle of a migration to Postgres from MySQL and i'v hit an issue that I just can't solve. I'm sure there is simple answer, but i'm stuck.
The Problem
I have a step model that belongs to ...
0
votes
1answer
16 views
How could one use Python's DBAPI to portably validate a database schema?
I'm writing a utility which I intend to be useable with at least three different database server backends (SQLite3, PostgreSQL, and MySQL). I'm not using an ORM (though I try a fork using SQLAlchemy ...
0
votes
2answers
38 views
Database for saving date span
I have a question generally about database design.
I need to store price for different room types for different hotels for different dates. The date could be a interval or it could be specific ...
0
votes
1answer
31 views
Using sequelize, how do you use an OR operator with the where criteria?
From a previous SO discussion I was able to update multiple sequelize instances with two conditions.
Can anyone explain how I can modify the sequelize .update method using a logical OR operator ...
-4
votes
0answers
26 views
Cannot render html.erb- completed 500 internal server error
I have begun converting a Postgres database to mysql and suddenly cannot render my other webpages. I am trying to get http://reinhartsample.com/coffee and other pages to render. They were working ...
0
votes
1answer
43 views
Updating multiple records using sequelize and nodejs?
Using node.js (v0.10.12) and sequelize (2.0.0-dev9), I am wanting to update attributes within an existing database table. From anther SO discussion I am able to update only one record at a time. I ...
0
votes
2answers
24 views
Get a subset of rows grouping by one of them
I am working on a ecommerce site with products, products variants, etc.
I have made a complex query that throws the following results.
id | product_id | options
----+------------+---------
1 | ...
0
votes
1answer
27 views
Sorting order behaviour between Postgres and Mysql
I have faced some strange sort order behaviour between Postgres & mysql.
For example, i have created simple table with varchar column and inserted two records as below in both Postgres and Mysql.
...
0
votes
2answers
44 views
For each / query doesn't give the right value
I have a table in my database. I want to get ltotal value from leave table, and then count all of ltotal. Here are my query and code I use:
$annual_query = pg_query("select ltotal from leave where ...
1
vote
1answer
37 views
Saving check boxes choices with Perl and PostgreSQL
I'm trying to create a user's preference page that has a bunch of check boxes letting the user decide how they want to receive their notifications. Here is my current HTML form for preferences:
...
0
votes
1answer
32 views
Selecting Positive/Negative Values of a computation SQL
I have a User model and a Workplace model. User has a field gender(m/f) and each workplace has many users. I want to select the count of total number of users in a workplace and also the count of ...
2
votes
2answers
29 views
Selecting Multiple Counts from the database
I have a User model and a Workplace model.
User has a field gender(m/f) and each workplace has many users.
I want to select the count of total number of users in a workplace and also the count of ...
0
votes
2answers
34 views
MySQL - Postgres: Wrapping multiple rows into one
Here is an example of the current rows as is:
id sdate subject exam1 assgn1 overallmark result credits
...
1
vote
1answer
21 views
Yii Rights module error after converting to postgres
I have changed my applicaiton database from mysql to postgres since this the rights module is giving exception:
`CDbCommand failed to execute the SQL statement: SQLSTATE[42P01]: Undefined table: 7
...
2
votes
4answers
52 views
I would like to find goes up by one and falls by one. Use SQL
I think about that problem for one week.
Anyway.I would like to find goes up by one and falls by one. Use SQL.
For example
This table exists.
name: ValTable
No val
1 → 2
2 → 3 ...
-1
votes
1answer
39 views
Postgres not allowing “>=” but mysql does, how to overcome?
My local rails database is mysql but my server host (heroku) is Postgres.
Probably a fairly common combination.
I have an advanced search form that work locally in development mode but not in ...
1
vote
1answer
35 views
Zend pgsql connection error
I get the following error while connecting with zend and pgsql
earlier my program was in mysql working fine
Array ( [host] => localhost
[username] => openerp
[password] ...
0
votes
1answer
36 views
SQL : Insert and Update a new column from existing column
Query matching string tags
SQL : Insert and Update a new column from existing column
I want to insert a new column in my PostGRESQL data, parsing from an existing column.
I have a string ...
-1
votes
1answer
47 views
Database design for the web-app [closed]
Hello I am in a problem of designing a web-app database schema .
Suppose i have 10 shops and every shop gives deals on every different day Sunday Monday and so on and for limited time period like ...
0
votes
1answer
40 views
SQL : should I insert another column or parse every single row
Assume millions of lines of traffic data in SQL format.
From the column URL and for each row of given range, I want to get a substring text that matches the target tag.
For example, from the column ...
0
votes
2answers
42 views
changing database from PostgreSQL to MySQL in a Ruby on Rails app
In my current application i am using PostgreSQL Data base,
but I want to change the PostgreSQL database into MYSQL DB.
if it's impossible ?
0
votes
1answer
47 views
mysql to postgresql query conversion
I have this query in MySql and I was wondering, will it be ok in postgresql?
I am wondering whether it should be something i need to change :)
I am mostly concerned with the group by function that ...
-3
votes
0answers
24 views
PostgreSQL or MySQL? [duplicate]
I am going to start building a database for a web page application. I will use PHP language to manipulate dynamic pages. I know a bit of MYSQL and a little about PostgreSQL. I am wondering to know ...
1
vote
1answer
52 views
Does SQL guarantee that the results of a join will be grouped together?
In SQL, when joining two tables, is the user guaranteed to have the resulting tuples grouped together?
E.g.: in the following example, would the result be consistently listed showing all the pets ...
-2
votes
1answer
60 views
SQL SELECT + INNER JOIN + WHERE [closed]
So I have this query and can't see whats wrong
SELECT tasks.id,tasks.client_name,tasks.description,tasks.state,
tasks.planned_dates, tasks.task_for, tasks.task_type,
tasks.solution, ...
0
votes
2answers
32 views
Converting MySQL indexes with duplicate names to PostgreSQL
I'm converting some CREATE TABLE queries from MySQL to Postgres and have encountered an issue with creating multiple keys (aka Indexes) with the same name on different tables.
For example, in MySQL ...
-2
votes
2answers
46 views
Converting MySQL Query to PostgreSQL
I'm working out a query that I've ran successfully in MySQL for a while, but in PostgreSQL it's not working
Here's the query:
SELECT
CONCAT('SELECT SUBSTRING(year1,7,4) as year2,',
...
2
votes
2answers
48 views
GROUP BY only primary key, but select other values
Is there a way to group by a unique (primary) key, essentially giving an implicit guarantee that the other columns from that table will be well-defined?
SELECT myPrimaryKey, otherThing
FROM myTable
...
1
vote
3answers
48 views
is JDBC code tied for single database type?
Consider this scenario: During development, I want to use MySQL and in production I will be using derby.
To get connection, I have this method from java tutorial :
public Connection getConnection() ...
3
votes
1answer
39 views
Liquibase script for MYSQL
I have a liquibase xml script. When I run it on Postgres I don't face any problem but when I run it for MYSQL it gives error when the structure is of the following type:-
<insert ...
0
votes
1answer
24 views
SQL: Application cross-db maintain only one generic schema
I actually have an application based on MySQL with a schema based on InnoDB (with constraints...)
My co-workers need to import this schema, so I export my schema in SQL files.
For example:
DROP ...
0
votes
1answer
53 views
Discussion/Advice: Redis vs Postgres/MySQL for small data [closed]
I have a web app where I make a call to an API and get JSON data which is made every 10 mins to keep data updated. I was thinking of using redis as storage for this JSON data rather than MySQL or ...
0
votes
1answer
31 views
Restore .backup file of postgreSql in MySql server
Is there any simple way to import .backup files of postgreSql database to MySql database to create a Spatial database.
0
votes
3answers
48 views
When do I need to restart database server in Django? [closed]
I was wondering in which cases do I need to restart the database server in Django on production. Whether it is Postgres/MySQL, I was just thinking do we need to restart the database server at all. If ...