background preloader

PostregSql

Facebook Twitter

Updating Enum Values in PostgreSQL - The Safe and Easy Way. Tl;dr: ALTER TYPE status_enum RENAME TO status_enum_old; CREATE TYPE status_enum AS ENUM('queued', 'running', 'done'); ALTER TABLE job ALTER COLUMN job_status TYPE status_enum USING job_status::text::status_enum; DROP TYPE status_enum_old; Unfortunately, there is no ALTER TYPE name DROP/RENAME VALUE ... in psql (as of 9.6).

Updating Enum Values in PostgreSQL - The Safe and Easy Way

The most popular solutions I found for this problem were always one of these two: "Drop and re-create the type. " This solution alone is no good if the type is already in use as you would have to drop any columns that use the type. "Modify the system tables with DELETE FROM pg_enum... " Instead, lets create a new type with the correct enum values and swap out the old one. Example Scenario. Comment réaliser de belles requêtes SQL avec Doctrine - Wanadev. Difficulté : | 20' Publié il y a 2 ans Doctrine est un ORM populaire offrant de nombreuses possibilités mais pas toujours bien mises en valeur.

Comment réaliser de belles requêtes SQL avec Doctrine - Wanadev

Cet article a pour but de montrer plusieurs manières de concevoir ses requêtes SQL. Chez Wanadev, nous avons pour habitude d'utiliser l'ORM Doctrine avec nos projets Symfony. Doctrine est depuis la version 2 du Frawework Full Stack l'ORM par défaut. Malgré toutes les critiques émises contre lui (performance, consommation mémoire, complexité…), on constate que nous disposons aujourd'hui de peu d'alternatives. La seule proposant peu ou prou les mêmes outils est Propel mais encore faudrait-il que cette solution s'intègre aussi bien que son concurrent. En dépit des performances médiocres décrites dans de nombreux articles faits par la communauté, ce qui nous gêne le plus reste la flexibilité d'utilisation. Les « fonctions primaires » qui sont disponibles dans le vendor sont : De cette même manière, les opérateurs conditionnels disponibles sont : PostgreSQL: Documentation: 9.1: Date/Time Functions and Operators.

Table 9-28 shows the available functions for date/time value processing, with details appearing in the following subsections.

PostgreSQL: Documentation: 9.1: Date/Time Functions and Operators

Table 9-27 illustrates the behaviors of the basic arithmetic operators (+, *, etc.). For formatting functions, refer to Section 9.8. You should be familiar with the background information on date/time data types from Section 8.5. All the functions and operators described below that take time or timestamp inputs actually come in two variants: one that takes time with time zone or timestamp with time zone, and one that takes time without time zone or timestamp without time zone. For brevity, these variants are not shown separately. Doctrine-postgis/README.md at master · jsor/doctrine-postgis.

Postgresql - Connecting to an external database with pgAdmin III. I'm trying to connect to an external database from pgAdmin III (which is installed on both machines).

postgresql - Connecting to an external database with pgAdmin III

The client complains: The server doesn't grant access to the database: the server reports FATAL: no pg_hba.conf entry for host "192.168.108.161", user "postgres", database "postgres", SSL off To access a database on a PostgreSQL server, you first have to grant primary access to the server for your client (Host Based Authentication). PostgreSQL will check the pg_hba.conf file if a pattern that matches your client address / username / database is present and enabled before any SQL GRANT access control lists are evaluated. The initial settings in pg_hba.conf are quite restrictive, in order to avoid unwanted security holes caused by unreviewed but mandatory system settings. You'll probably want to add something like host all all 192.168.0.0/24 md5 This example grants MD5 encrypted password access to all databases to all users on the private network 192.168.0.0/24.

Créer une API en Java avec Jersey et Jackson. Dans cet article, nous allons voir comment intégrer Jersey avec Jackson pour développer des services RESTful JAX-RS qui retourne ou renvoit du JSON.

Créer une API en Java avec Jersey et Jackson

Comme vous le savez peut-être, Jackson est utilisé pour convertir un objet Java en objet JSON et inversement. Avant de commencer, il va vous falloir installer quelques pré-requis: Après avoir installé les pré-requis, nous allons créer le projet dans Eclipse. Pour cela, créez un nouveau "Dynamic Web Project": Entrez le nom du projet (ici "RestServer") et choisissez le dossier du projet si besoin. Installer PostgreSQL avec Wamp. Install PostgreSQL on Linux and Windows. Demo of a simple CRUD RESTful PHP service used with AngularJS and MySQL. <?

Demo of a simple CRUD RESTful PHP service used with AngularJS and MySQL

Php. PostgreSQL with php - a thorough introduction. Introduction This tutorial will get you started with PostgreSQL with PHP.

PostgreSQL with php - a thorough introduction

You will learn to create a simple web application with PostgreSQL and PHP. As you know, PostgreSQL is one of the most popular and robust open source relational database management system and PHP is perhaps the most popular open source server-side programming language for developing web applications. Requirements for development and installation To install PostgreSQL on Linux and Windows we have discussed here, detail installation process. PostgreSQL: Documentation: 8.1: Backup and Restore. As with everything that contains valuable data, PostgreSQL databases should be backed up regularly.

PostgreSQL: Documentation: 8.1: Backup and Restore

While the procedure is essentially simple, it is important to have a basic understanding of the underlying techniques and assumptions. There are three fundamentally different approaches to backing up PostgreSQL data: Each has its own strengths and weaknesses. The idea behind the SQL-dump method is to generate a text file with SQL commands that, when fed back to the server, will recreate the database in the same state as it was at the time of the dump. PostgreSQL. Un article de Wikipédia, l'encyclopédie libre.

PostgreSQL

YUM Installation. PostgreSQL can be installed using RPMs (binary) or SRPMs (source) managed by YUM.

YUM Installation

This is available for the following Linux distributions (both 32- and 64-bit platforms; for the current release and prior release or two): Fedora Red Hat Enterprise Linux CentOS Scientific Linux Oracle Enterprise Linux See links from the main repository, Instructions Configure your YUM repository Locate and edit your distributions .repo file, located: Install PostgreSQL 9.1.3 with pgAdmin3 on CentOS 6 / RHEL 6 - IT'zGeek -

PostgreSQL is an object-relational database management system (ORDBMS) available for many platforms including Linux, FreeBSD, Solaris, Microsoft Windows and Mac OS X. It is released under the PostgreSQL License, which is an MIT-style license, and is thus free and open source software. PostgreSQL is developed by the PostgreSQL Global Development Group, consisting of a handful of community volunteers employed and supervised by companies such as Red Hat and EnterpriseDB. It implements the majority of the SQL:2008 standard, is ACID-compliant, is fully transactional (including all DDL statements), has extensible data types, operators, and indexes, and has a large number of extensions written by third parties.

PostgreSQL - JAVA Interface. Installation Before we start using PostgreSQL in our Java programs we need to make sure that we have PostgreSQL JDBC and Java set up on the machine.