Finding and Reporting Postgres Bug #8291 BY: LLOYD ALBIN 8/6/2013.

Slides:



Advertisements
Similar presentations
MY NCBI (module 4.5). MODULE 4.5 PubMed/How to Use MY NCBI Instructions - This part of the: course is a PowerPoint demonstration intended to introduce.
Advertisements

MY NCBI (module 4.5). MODULE 4.5 PubMed/How to Use MY NCBI Instructions - This part of the: course is a PowerPoint demonstration intended to introduce.
PHP II Interacting with Database Data. The whole idea of a database-driven website is to enable the content of the site to reside in a database, and to.
PHP SQL. Connection code:- mysql_connect("server", "username", "password"); Connect to the Database Server with the authorised user and password. Eg $connect.
Welcome to the Online Employment Applicant Tutorial Click here for next screen.
ADABAS to RDBMS UsingNatQuery. The following session will provide a high-level overview of NatQuerys ability to automatically extract ADABAS data from.
MY NCBI (module 4.5). MODULE 4.5 PubMed/How to Use MY NCBI Instructions - This part of the:  course is a PowerPoint demonstration intended to introduce.
MY NCBI (module 4.5).
WaveMaker Visual AJAX Studio 4.0 Training
PHP and MySQL Database. Connecting to MySQL Note: you need to make sure that you have MySQL software properly installed on your computer before you attempt.
1.  Understanding about How to Working with Server Side Scripting using PHP Framework (CodeIgniter) 2.
SQL This presentation will cover: A Brief History of DBMS View in database MySQL installation.
Finding and Reporting Postgres Bug #8257 BY: LLOYD ALBIN 8/6/2013.
What is MySQL? MySQL is a relational database management system (A relational database stores data in separate tables rather than putting all the data.
DIMES Planner The DIMES Project Tel Aviv University October-2010.
How to corrupt your data by accident BY: LLOYD ALBIN 9/3/2013.
Let’s try Oracle. Accessing Oracle The Oracle system, like the SQL Server system, is client / server. For SQL Server, –the client is the Query Analyser.
1 Design patterns Lecture 4. 2 Three Important skills Understanding OO methodology Mastering Java language constructs Recognizing common problems and.
In an internet browser type: If you have never used this software before, click on create an account. If you have used ilrn, click on Sign.
Attribute databases. GIS Definition Diagram Output Query Results.
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
WebXtender Tutorial just use the arrow keys to navigate the slides.
OLE and ODBC: Taming the Technologies The Third Annual Perl Conference, 1999 Sunday, August 22, 1999Roth Consulting ODBC.
APPX 4.3 Overview. APPX 4.3  System Administration Application Change Management (SCCS) Application Change Management (SCCS) Runtime Process Monitor.
Databases with PHP A quick introduction. Y’all know SQL and Databases  You put data in  You get data out  You can do processing on it very easily 
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Chapter 5 Introduction to SQL. Structured Query Language = the “programming language” for relational databases SQL is a nonprocedural language = the user.
MySQL in PHP – Page 1 of 17CSCI 2910 – Client/Server-Side Programming CSCI 2910 Client/Server-Side Programming Topic: MySQL in PHP Reading: Williams &
PostgreSQL and relational databases As well as assignment 4…
ENTERING ELIGIBLE ENERGY RESOURCE APPLICATIONS IN DELAFILE Version 2.0 August 25, 2015.
BIO1130 Lab 2 Scientific literature. Laboratory objectives After completing this laboratory, you should be able to: Determine whether a publication can.
PostgreSQL and relational databases As well as assignment 4…
1 Online Textbook Adooptions
Credit Union National Association Installing and Uploading Project Zip Code.
Part 1 – PubMed Interface, Display options, Saving, Printing, and ing results. Instructions This part of the course is a PowerPoint demonstration.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
SYST Web Technologies SYST Web Technologies Databases & MySQL.
1. Connecting database from PHP 2. Sending query 3. Fetching data 4. Persistent connections 5. Best practices.
Tools Menu and Other Concepts Alerts Event Log SLA Management Search Address Space Search Syslog Download NetIIS Standalone Application.
(Chapter 10 continued) Our examples feature MySQL as the database engine. It's open source and free. It's fully featured. And it's platform independent.
1 What is database 2? What is normalization? What is SQL? What is transaction?
Warehouse Report. Log into EDS using your Address/User Id and Password. If you have forgotten your password, click on the Forgot Password? link.
PHP+MySQL Integration. Connecting to databases One of the most common tasks when working with dynamic webpages is connecting to a database which holds.
FEN  Data Definition: CREATE TABLE, ALTER TABLE  Data Manipulation: INSERT, UPDATE, DELETE  Queries: SELECT SQL: Structured Query Language.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
Topics Sending an Multipart message Storing images Getting confirmation Session tracking using PHP Graphics Input Validators Cookies.
Database Programming Sections 11 & 12 –Sequences, Indexes, and Synonymns.
PHP getting data from a MySQL database. Replacing XML as data source with MySQL Previously we obtained the data about the training session from an XML.
Form Handling IDIA 618 Fall 2014 Bridget M. Blodgett.
CHAPTER 10 PHP MySQL Database
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 1: Introduction to IS2803 Rob Gleasure
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
PubMed/How to Search, Display, Download & (module 4.1)
ASSIGNMENT 2 Salim Malakouti. Ticketing Website  User submits tickets  Admins answer tickets or take appropriate actions.
Starting with Oracle SQL Plus. Today in the lab… Connect to SQL Plus – your schema. Set up two tables. Find the tables in the catalog. Insert four rows.
SQL Injection Attacks An overview by Sameer Siddiqui.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
Log Shipping, Mirroring, Replication and Clustering Which should I use? That depends on a few questions we must ask the user. We will go over these questions.
Software-Projekt 2008 Seminarvortrag“Short tutorial of MySql“ Wei Chen Verena Honsel.
The Chest – Supplier Training Information. Website url
Florida Department of Business and Professional Regulations Ken Lawson Juana Watkins Secretary Director Division of Real Estate.
1 Copyright © 2005, Oracle. All rights reserved. Oracle Database Administration: Overview.
Introduction to tds_fdw
Welcome POS Synchronize Concept 08 Sept 2015.
BIO1130 Lab 2 Scientific literature
Chapter 5 Introduction to SQL.
Easy Way to Reset WordPress Admin Password on Localhost? Guided By: WPGLOBALSUPPORTWPGLOBALSUPPORT.
Introduction to the New SSA OnePoint Online Website
2016, Fall Pusan National University Taehoon Kim
BIO1130 Lab 2 Scientific literature
Presentation transcript:

Finding and Reporting Postgres Bug #8291 BY: LLOYD ALBIN 8/6/2013

The Bug There are really two issues that I found. ALTER USER MAPING webpage – The directions for updating the password are incorrect. postgres_fdw extension – If you update the password, you may not know there is a problem due to password caching.

Creating the databases Create two databases and then log into db1. CREATE DATABASE db1 WITH ENCODING='UTF8' OWNER=postgres CONNECTION LIMIT=-1; CREATE DATABASE db2 WITH ENCODING='UTF8' OWNER=postgres CONNECTION LIMIT=-1;

Creating a test table Create a test table and then insert one row of data so that we can verify reading this table from the second database. CREATE TABLE public.tbl_test ( field character varying, CONSTRAINT tbl_test_field_pkey PRIMARY KEY (field) ); ALTER TABLE public.tbl_test OWNER TO postgres; INSERT INTO public.tbl_test VALUES('Test Value');

Installing the foreign data extension Log into db2 and then install the postgres_fdw extension. CREATE EXTENSION postgres_fdw;

Create a foreign data table To create a foreign data table we first need to create the server, then the user mapping, and then lastly the foreign data table. CREATE SERVER myserver FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host 'localhost', dbname 'db1', port '5432'); CREATE USER MAPPING FOR postgres SERVER myserver OPTIONS (user 'postgres', password 'password'); CREATE FOREIGN TABLE tbl_test ( field character varying ) SERVER myserver;

Testing the foreign data table. A simple query of the foreign data table returns the data from db1. SELECT * FROM tbl_test; -- This works, we should see the 'Test Value' returned.

Changing the password According to the documentation for 8.4 – 9.3 and devel, this is how you change the password for a user. org/docs/9.3/static/sql- alterusermapping.html Examples Change the password for user mapping bob, server foo: ALTER USER MAPPING FOR bob SERVER foo OPTIONS (user 'bob', password 'public');

First Problem The problem is that the documentation is incorrect. This syntax does not work. They do state the correct syntax on the page, just not in their example. ALTER USER MAPPING FOR postgres SERVER myserver OPTIONS (user 'postgres', password 'badpass'); ERROR: option "user" provided more than once ********** Error ********** ERROR: option "user" provided more than once SQL state: 42710

The correct ALTER USER MAPPING This is the way it should be written. ALTER USER MAPPING FOR postgres SERVER myserver OPTIONS (SET password 'badpass');

Second Problem This should have failed due to the bad password. The problem is that the postgres_fdw is caching the password and not monitoring for password changes unless the password that is cached fails and then it will re- read the password and test the password before giving success or failure. This problem does not exist when using the dlink, that also uses the same USER MAPPING’s. SELECT * FROM pg_catalog.pg_user_mapping; -- Verified that password was properly changed. SELECT * FROM tbl_test; Total query runtime: 1970 ms. 1 row retrieved.

Submitting the bug The first thing you should do is to search the pgsql-bugs and pgsql- hackers mailing lists for your problem. If you don’t find it, then go ahead and submit a bug ticket. The form will ask you for the following information: Name PostgreSQL version Operating System Short Description Long Description

The submitted bug To see the full bug submission: org/message- id/E1Uwg2C-0008Dq- l.org From: lalbin(at)fhcrc(dot)org To: pgsql-bugs(at)postgresql(dot)org Subject: BUG #8291: postgres_fdw does not re- read USER MAPING after change. Date: :05:20 The following bug has been logged on the website: Bug reference: 8291 Logged by: Lloyd Albin address: lalbin(at)fhcrc(dot)org PostgreSQL version: Operating system: SUSE Linux (64-bit)

Response to the caching problem Bernd Helmle response to the caching problem is not to do anything. > I have found that if you change the password in the USER MAPPING, that postgres_fdw will not use it unless the current password fails or you close and re-open your postgres connection. I found this while testing to see if the USER MAPPING's supports MD5 passwords and they appeared to work until the next day when I found that they no longer worked because I had closed and re-opened my connection. Hmm i don't think that's a bug. It's because the postgres_fdw caches the connection within your local session, reusing it for any subsequent foreign table access.

Response to the documentation problem Bernd Helmle did make changes to the documentation. org/message- id/01D9AE3B275492A46 > The second error that I found is in the documentation of ALTER USER MAPPING. It incorrectly says how to update a users password. It could be misread, i agree. Attached is a small doc patch to address this against HEAD.

The changes to the documentation The patch to the documentation will make these changes. Examples Add a password for user mapping bob, server foo: Change the password for user mapping bob, server foo: ALTER USER MAPPING FOR bob SERVER foo OPTIONS (ADD password 'public'); ALTER USER MAPPING FOR bob SERVER foo OPTIONS (SET password 'public');

My issue with the non-fix for the caching There was no response to this. org/message- id/AE011E7AE E1E2BD341F4E0933D I realized that postgres_fdw is caching the connection, but when you have existing items that use the same USER MAPPING and do not cache it such as dblink you get inconsistency in implementation and this should be avoided.

Patch Commitment I can find nothing on the pgsql-committers mailing list, nor any other mailing list, about the documentation patch being committed.

Documentation Affected Versions The documentation issue, affected versions: Beta 2 devel It is affecting all current versions 8.4+ as of 8/6/2013.

Caching Affected Versions The caching issue, affected versions: 9.3 Beta 2 devel It is affecting all current versions 9.3+ as of 8/6/2013.