---
title: "让mysql快速兼容postgresql"
author: "JadeLuo"
date: "2016-06-29T16:43:06Z"
tags: []
categories: ["数据库"]
slug: "mysql-postgresql"
draft: false
lastmod: "2016-06-29T16:43:06Z"
id: 2308075
url: "https://jadeluo.iteye.com/blog/2308075"
---

```
CREATE DEFINER=`root`@`192.168.1.%` FUNCTION `to_char`(`date` datetime,`format` VARCHAR(20)) RETURNS date
BEGIN
	#Routine body goes here...

	RETURN  date_format(date, '%Y-%m-%d');
END
```