Category "postgresql"

Doctrine2 Criteria convert 1 to TRUE

I've got a problem with Criteria from Doctrine2. Iusing Criteria to check a SMALLINT type in PostreSQL like this : $criteria = Criteria::create()->where(Crit

Auto increment table column

Using Postgres, I'm trying to use AUTO_INCREMENT to number my primary key automatically in SQL. However, it gives me an error. CREATE TABLE Staff ( ID

PostgreSQL asking for 'group by' clause in where, when sending parameters

I have a simple query in PostgreSQL which is ok when I run it without any query parameters : select date_trunc('week', action_time),count(*) from event

What happens after I add an index to a large table in a production Rails app and then migrate?

Rails 3.2 app running on Heroku with Postgres. I added an index add_index :lines, :event_id Events have_many Lines. There are about about 2 million Lines and

Facing this issue with creating a superuser

While trying to execute this command: (venv) sreekarsiddula@Sreekars-MacBook-Air bidgala % /Users/sreekarsiddula/piapps/venv/bin/python3 manage.py createsuperus

Best way to select random rows PostgreSQL

I want a random selection of rows in PostgreSQL, I tried this: select * from table where random() < 0.01; But some other recommend this: select * from table

Is there way to use pg_cron from the google cloud sql?

Currently I need to move my database from postgreSql to google cloud sql. I use pg_cron to remove stale records like this: SELECT cron.schedule('30 3 * * 6',

Create PostgreSQL ROLE (user) if it doesn't exist

How do I write an SQL script to create a ROLE in PostgreSQL 9.1, but without raising an error if it already exists? The current script simply has: CREATE ROLE

Is there a multivalued field type available in PostgreSQL?

I want to know if it is possible to store multiple values in a field in PostgreSQL. I have a table called Token with the columns id, text and category. categor

Select last n rows without use of order by clause

I want to fetch the last n rows from a table in a Postgres database. I don't want to use an ORDER BY clause as I want to have a generic query. Anyone has any su

How to set auto increment primary key in PostgreSQL?

I have a table in PostgreSQL with many columns, and I want to add an auto increment primary key. I tried to create a column called id of type BIGSERIAL but pgad

PostgreSQL: Show all the privileges for a concrete user

How to make a query to the Postgres data dictionary to find out all the privileges that a particular user has. I've been looking for a solution and I can not f

How to write DataFrame to postgres table

There is DataFrame.to_sql method, but it works only for mysql, sqlite and oracle databases. I cant pass to this method postgres connection or sqlalchemy engine.

Getting a nullpointerexception for my EntityManager

Working with Wildfly 10 on the following: a JSON webservice accessing a postgresql db using hibernate through a DAO object. More specifically, my POJO User.jav

Display select results vertically in psql, as is done by MySQL's \G

In MySQL, you can terminate a select query with \G (as opposed to \g) to display the results vertically: select * from foo \G *************** id: 1 bar: Hell

ERROR Relation already exists in PostgreSQL when creating an index on a table

I have an error when running the the queries below on PostgreSQL from a Java code ..... sql = "CREATE TABLE IF NOT EXISTS table1 (s VARCHAR(100), p VARCHAR(

How can I mock nest typeorm database module in end to end (e2e) tests?

all. Include details about your goal: I'm trying to mock repository in e2e test Describe expected and actual results: Request to server will not have access

postgresql: INSERT INTO ... (SELECT * ...)

I'm not sure if its standard SQL: INSERT INTO tblA (SELECT id, time FROM tblB WHERE time > 1000) What I'm looking for is: what if tblA and

Postgres: Install a specific version of plv8

I'm installing plv8 in docker: FROM postgres:13 AS build ENV PLV8_VERSION=v3.0.0 RUN apt-get update && apt-get upgrade \ && apt-get instal

Syncing PouchDB offline to PostgreSQL

I am trying to make my web application work on offline mode by using pouchDB. but the backend database server i used is PostgreSQL (NoSQL). I couldn't find a wa